Skip to content
Advertisement

Use one of two dates in where clause

I need to delete all records in a table where the CreatedDate or ModifiedDate is greater than x. The logic is as follows:

  • If ModifiedDate is not null then use this value
  • Otherwise use the CreatedDate value

Not applying the if/else statement correctly.

Advertisement

Answer

Use this where clause:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement