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 |
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2008-06-04 : 10:54:21
|
[code]sqid sqlnm STPID stID----- ------- ----- -------- 16455 Fruits 13 5016457 Apples 12 5016488 grapes 12 50TableB-------HPID Msqid Dsqid---- ------ ------16458 16455 1645716489 16455 16488I need the below output:StId sqlnm Count------- ----- ----50 Fruits 2Thanks for your help in advance !![/code] |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-06-04 : 10:59:43
|
[code]select A.stID, A.sqlnm, count(B.Dsqid) as [Count]from TableA A join TableB Bon A.sqid = B.MsqidGroup by A.stID, A.sqlnm[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2008-06-04 : 13:43:46
|
Thanks harsh !! |
 |
|
|
|
|