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 |
|
girishhande
Starting Member
26 Posts |
Posted - 2009-07-23 : 01:20:39
|
| hi ihave table like below e.g.id name1 abc1 xyz1 pqr2 tyy2 yyy3 bbb3 iiii want result from query like id number and row count with duplicate idlikeid rowcnt1 32 23 2plz give query for this?gkh |
|
|
Mangal Pardeshi
Posting Yak Master
110 Posts |
Posted - 2009-07-23 : 01:24:39
|
| Its simple case of GROUP BY and COUNT.Try writting one GROUP BY query, if get stuck post back we will help you.Mangal Pardeshihttp://mangalpardeshi.blogspot.com |
 |
|
|
girishhande
Starting Member
26 Posts |
Posted - 2009-07-23 : 01:26:20
|
| hey i have tried but nt geting..plz give querygkh |
 |
|
|
Mangal Pardeshi
Posting Yak Master
110 Posts |
Posted - 2009-07-23 : 01:26:59
|
| post the query you tried.Mangal Pardeshihttp://mangalpardeshi.blogspot.com |
 |
|
|
girishhande
Starting Member
26 Posts |
Posted - 2009-07-23 : 01:30:44
|
| count * from _tablegoupby idgkh |
 |
|
|
Mangal Pardeshi
Posting Yak Master
110 Posts |
Posted - 2009-07-23 : 01:32:34
|
| SELECT id, COUNT(*)FROM tablenameGROUP BY idMangal Pardeshihttp://mangalpardeshi.blogspot.com |
 |
|
|
Mangal Pardeshi
Posting Yak Master
110 Posts |
|
|
girishhande
Starting Member
26 Posts |
Posted - 2009-07-23 : 01:35:31
|
| thnksgkh |
 |
|
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-07-23 : 02:49:11
|
| select id,count(*) from urtable group by id if u want only which have records or count greater then 1 then select id,count(*) from urtable group by id having count(*) >1i think like this..iF theRe iS a wAy iN tHen theRe iS a wAy oUt.. |
 |
|
|
|
|
|