467,134 Members | 983 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,134 developers. It's quick & easy.

Comparing multiple fields in a table

I have a table with 3 date fields that for any given record should all be populated with the same date (the fields mean 3 different things, just have the same date)

Is there a function that allows me to determine if all the fields are equal and if not return those records?

Thanks for any help.
Nov 20 '08 #1
  • viewed: 2606
1 Reply
Expert 2GB
try this:

Expand|Select|Wrap|Line Numbers
  2. select * from yourtable
  3. where datediff(dd,firstdatecolumn,seconddatecolumn) + datediff(dd,seconddatecolumn,thirddatecolumn)  <> 0
records will return if one of them have different day part. if your dates have different time part but has the same date part, the above query will treat them equal.

-- CK
Nov 20 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by laxmiuk@yahoo.com | last post: by
11 posts views Thread by dskillingstad@gmail.com | last post: by
4 posts views Thread by Working_Girl | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.