Friday, March 23, 2012

How to get the latest & earliest date?

Hi,

How to get the latest date from ColumnDateTime?

and the earlier as well ?

select max(columnDateTime), -- for lastest date
min(columnDateTime) -- for earliest date|||Thanks a lot :)|||what if I want to use it with "WHERE" Condition ?|||

Maybe something like

select max(columnDateTime)
from yourSourceTable
where anIntegerColumn = 14

If your column is a varchar column that WHERE condition will look like:

where aVarcharColumn = 'theTargetString'

No comments:

Post a Comment