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 |
|
hoda02
Starting Member
1 Post |
Posted - 2012-08-19 : 11:12:52
|
| Hi,I have a list like this in a tableNumber Block1.........22.........23.........44.........5 It means that Number 1,2 can go to block 2 only, and number 3 can go to block 4 only and etc.And I have bellow data to another table:Number Block date1.........2 2001/01/011.........2 2001/01/021.........2 2001/01/03 1.........3 2001/01/042.........2 2001/01/012.........3 2001/01/03It means that Number 1 has gone to Block 2 and 3 and number 2 has gone to block 2 and 3Now I want to select some numbers they have gone in some blocks except for their blocks. It means Number 1 in date 2001/01/04 and Number 2 in date 2001/01/03How can I do this? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-08-19 : 13:48:33
|
| [code]SELECT *FROM Table2 t2WHERE NOT EXISTS (SELECT 1 FROM Table1 WHERE Number = t2.Number AND Block = t2.Block)[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|