Table name: T1, it has only one column.
col1
------
c
b
a
b
b
b
b
d
s
a
a
t
s
Requirement:
I need the following output from the above base table by
using SQL query.
col1 Cnt
----- -------
a 3
b 5
Others 5
Please help.
Thanks
Guru
v.gurus@in.com
Answers were Sorted based on User's Feedback
Answer / dinakar
select col1,count(*) cnt from T1 where col1 in
(select distinct col1 from T1 )
group by col1
| Is This Answer Correct ? | 1 Yes | 6 No |
What is nested table in pl sql?
What does desc stand for?
what are sequences
What is the sql query to display the current date?
How to check if a column is nullable before setting to nullable?
What are the possible values for the boolean data field?
Can a key be both primary and foreign?
Is sql a programming?
What is the importance of sqlcode and sqlerrm?
Can you create a table with Primary Key not as the clustered index.
What is indexing oracle sql?
What is the most important ddl statements in sql are?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)