View previous topic :: View next topic |
Author |
Message |
butta_mvs Beginner
Joined: 17 Aug 2003 Posts: 22 Topics: 18
|
Posted: Fri Feb 13, 2004 12:13 pm Post subject: sql query |
|
|
i have a table with column tm having values
21
8
9
1
9
1
7
1
i need a query which will display as
tm no.of occurances
21 1
8 1
9 2
1 3
7 1
How can i do it. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Fri Feb 13, 2004 12:40 pm Post subject: |
|
|
Buttamvs,
This is a simple query using group by clause.
Code: |
SELECT TM
,COUNT(*)
FROM TABLE
GROUP BY TM
ORDER BY TM
;
|
Hope this helps....
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|