Returning Date from two Columns
Hi All
I would like to be able to return dates from two different date columns in a table the data needs to be greater than 2005 so for one column i added the following where statement
SELECT TOP (100) PERCENT ih_quodate, ih_orddate, ih_quotat, ih_sorder
FROM dbo.ihead
WHERE (ih_quodate >= '01/01/2005')
ORDER BY ih_quodate
this works fine and returns 13846 rows, but i also have another date column where i also need only values over 2005 so i added the following
WHERE (ih_quodate >= '01/01/2005') AND (ih_orddate >= '01/01/2005')
however now when i added the and statement the figures are wrong if i do them seperatly one at a time they are correct.
Anthing obvious.
John
January 20th, 2011 11:12am
I guess when you add the extra condition, your number of rows reduces considerably? When I read your requirement, it sounds like you want all rows where both ih_quodate and ih_orddate are greater than 2005 - is that correct? Or do you want all rows where
ih_quodate are over 2005 but only display the ih_orddate when its greater than 2005?every day is a school day
My Blog
Free Windows Admin Tool Kit Click here and download it now
January 20th, 2011 11:29am
Hi Thanks for the quick response
i have found the issue it was a date error thing in my data all sorted now.
Thanks Again
John
January 20th, 2011 11:49am