sql - Performing an Update query with a date -


can perform update query checking value of date whether date entered greater date stored in database.

if @input_date > table.date   update table set table.value = 0, table.date = @input_date else    update table set table.value = @input_value, table.date = @input_date 

use case statement

try this

    update table      set table.value = case when @input_date > table.date 0 else @input_value end,         table.date = @input_date 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -