SQL: How to compare dates while ignoring the time? -
how can compare dates of timestamps while ignoring times?
i want compare month/date/year. example:
select * batch openingtime <> closingtime
the problem show many batches, since include batches openingtime
, closingtime
differ in time of day:
openingtime = 2010-07-07 11:19:29.000
closingtime = 2010-07-07 19:19:22.000
cast both timestamps dates
for sql server
select * batch cast(openingtime date) <> cast(closingtime date)
for oracle
select * batch trunc(openingtime) <> trunc(closingtime)
Comments
Post a Comment