Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL insert statement help please

$
0
0

Hi all I'm trying to go a little out of my comfort level here and was hoping for some advice. I have a sql table that has 2 date fields. an add and a modified. If the modified date is null then I want to calculate on the date added. Otherwise I'd like to calculate on the modified date.


Here is a simplified version of what I'm trying to accomplish.

Hope it makes sense what I'm trying to do.


SQL
SELECTfield1,field2....,dateAdded,dateModifiedINTOtblOutputFROMtblInput/* some pseudo code here */WHERE(ifdateModifiednotnullthen(dateModified<={fnNOW()}-60)else(dateAdded<={fnNOW()}-60)


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>