View previous topic :: View next topic
|
Author |
Message |
lokeshwar_manoharan
New User
Joined: 22 Sep 2008 Posts: 49 Location: Chennai,Tamilnadu
|
|
|
|
Hi,
I want the maximum no of rows possible grouped by a particular column.
Code: |
SELECT COUNT(*) FROM <Table A>
GROUP BY A.Column1
|
If the above query returns 1,2,3 I need the answer as 3.
ie I need
Code: |
max(SELECT COUNT(*) FROM <Table A>
GROUP BY A.Column1).
|
Can it be achieved in SQL ? |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Code: |
SELECT a.column1,COUNT(*) FROM <Table A>
GROUP BY A.Column1
order by 2 Desc
Fetch first 1 row only |
|
|
Back to top |
|
|
lokeshwar_manoharan
New User
Joined: 22 Sep 2008 Posts: 49 Location: Chennai,Tamilnadu
|
|
|
|
Thanks.. it worked..!! |
|
Back to top |
|
|
|