开发者

SQL Updated since last visit column

I'm working with SQL Server and I'm pretty new to SQL in general, s开发者_高级运维o if this is a very trivial question, please bear with me.

I have a table in a database with a datetime field representing some timestamp. When extracting the table via a SELECT statement, I would like to have a column of True/False representing whether or not the row has been updated since some given time.

I've tried something like:

"SELECT val1, val2, FORMAT(LastTimestamp > " + GivenTime + ", 'True/False')" +
"FROM table"

I've gotten something similar to work on the w3 online query tester, but I think that may be in MySQL and I was unable to test datetimes. The database right now seems to complain about the > symbol.

Anyone know the proper query string?


something like:

select val1, val2, 
case when LastTimestamp > '20100720' then 'True' else 'False' end as [True/False] 
from Table

Note that in the above I've used a date literal which breaks down into 'yyyymmdd'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜