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 |
Christech82
Starting Member
20 Posts |
Posted - 2013-04-10 : 14:42:47
|
blank |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-04-10 : 15:11:39
|
You could query like shown below:select * from HOUSE hwhere not exists( select * from RENT_AGREEMENT r where r.HOUSE_NO = h.HOUSE_NUM); |
|
|
Christech82
Starting Member
20 Posts |
Posted - 2013-04-10 : 15:23:49
|
quote: Originally posted by James K You could query like shown below:select * from HOUSE hwhere not exists( select * from RENT_AGREEMENT r where r.HOUSE_NO = h.HOUSE_NUM);
It is worked Thank you much for your help James |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-11 : 02:22:26
|
you can also achieve it using LEFT JOIN or NOT INselect * from HOUSE hwhere h.HOUSE_NUM not in( select r.HOUSE_NO from RENT_AGREEMENT r )select h.* from HOUSE hLEFT JOIN RENT_AGREEMENT rON r.HOUSE_NO = h.HOUSE_NUMWHERE r.HOUSE_NO IS NULL ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-04-15 : 00:17:51
|
Hi Christech82, Don't delete your content after getting solution.. These posts will help others who have this type of problems |
|
|
|
|
|