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 |
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-08-30 : 03:30:51
|
| declare @master table (id int, names varchar(20), cnt int)insert into @masterselect 10, 'have', 2 union allselect 20, 'buy', 3 union allselect 30,'sell', 1select * from @masterdeclare @trans table (tid int, mid int, desg varchar(20), sal int)insert into @trans select 1,10,'pl',2000 union allselect 2,30,'tl',1000I need to get the output asid names cnt20, 'buy', 3i want to get those records whose id ( from master table ) doesnot match with mid (from trans table) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-30 : 03:39:31
|
is your sample output correct ? It does not matched your descriptionselect *from @master mwhere not exists ( select * from @trans t where t.mid = m.id ) KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-30 : 03:41:53
|
| [code]select m.*from @master mleft join @trans ton t.mid=m.idwhere t.mid is null[/code] |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-08-30 : 03:46:46
|
| Thanks alot to all.. |
 |
|
|
|
|
|
|
|