Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mukhan85
Starting Member
46 Posts |
Posted - 2008-12-24 : 12:35:39
|
| Hi I think that the following query returns all rows that have Status equal to '0' or '4'is it correct?select Task_idFROM Task WHERE ( Status NOT IN (0,4) OR CONVERT(char(4),DATEADD(second, Create_Date, '1969-12-31 8:00:00 PM'),112) >= '2006' OR CONVERT(char(4),DATEADD(second, Actual_End_Date, '1969-12-31 8:00:00 PM'),112) >= '2006' ) AND Category IN ('CRI','RFD')Thanks. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-12-24 : 12:45:47
|
| The query will return all rows where the status is not 0 or 4, the create is >= 2006 orthe actual_end_date >= 2006. So if the create_date is in 2007, you will get all statuses associated with itJim |
 |
|
|
mukhan85
Starting Member
46 Posts |
Posted - 2008-12-24 : 14:13:09
|
quote: Originally posted by jimf The query will return all rows where the status is not 0 or 4, the create is >= 2006 orthe actual_end_date >= 2006. So if the create_date is in 2007, you will get all statuses associated with itJim
But if Create >= 2006 then, it won't look even if Status is 0 or 4, so it will return all tickets that satisfy Create >= 2006 and Actual_end_date >= 2006 even if Status is 0 or 4 and those whose Status is 0 or 4 but won't look at Dates' |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-12-24 : 23:42:45
|
| Hi,Please post table structure , sample data and expected o/p so that we can give a query which is apt for u... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-25 : 01:34:16
|
| you still didnt tell us what's your exact reqmnt. can you please explain what you want? |
 |
|
|
|
|
|
|
|