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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -