I have two different columns as DateTime type : CREATION_DATE and UPDATE_DATE
I want to create a SELECT (some fields) statement which order by the column (UPDATE_DATE or CREATION_DATE not both) where UPDATE_DATE > CREATION_DATE and UPDATE_DATE must be NOT NULL
Why ? Any items will be create in DB and CREATION_DATE will be filled automatically but not UPDATE_DATE column.
When somebody modify an existing item then the UPDATE_DATE will be filled/updated at every modification and will be listed on UserInterface by UPDATE_DATE (ascendent).
How to do that ?
Sorry if my question is bad …
Use
isnull, ifUPDATE_DATEis null it usesCREATION_DATEto order rows.Read more about
isnullon MSDN.coalesceis an alternative and it’s going to work in most RDBMS (afaik).