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 |
|
kid_on_the_block
Posting Yak Master
172 Posts |
Posted - 2005-12-28 : 00:12:23
|
| Hi I have the following table , ----------------------------Code Particulars----------------------------A xxxxB yyyyA xxxxB yyyyB zzzzAnd CodeTable-----------------ABCNow I want a count of the above table I do Select count(code),code from table1 group by codeI get the following result2 A3 BI want the result like 2 A3 B0 CI have tried using joins but am unable to so so plz help.RegardsKid |
|
|
shallu1_gupta
Constraint Violating Yak Guru
394 Posts |
Posted - 2005-12-28 : 00:20:40
|
| try this..select code,countCode=(select count(particulars) from CodeParticulars b where a.code = b.code) from CodeTable a |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-28 : 00:46:37
|
| orSelect count(T1.code),T2.code from CodeTable T1 left join CodeParticulars T2 on t1.code=T2.codegroup by T2.codeMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|