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
Answer Posted / 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 |
Post New Answer View All Answers
What action do you have to perform before retrieving data from the next result set of a stored procedure ?
What is the requirement of self-join?
what are the advantages and disadvantages of cascading style sheets? : Sql dba
What is the difference between sql and t sql?
how can we encrypt and decrypt a data present in a mysql table using mysql? : Sql dba
Which are the different case manipulation functions in sql?
What is case function?
What are all the ddl commands?
Can we join 3 tables in sql?
Can we create foreign key without primary key?
What is the use of index in hive?
Which command is used to delete a package?
How to connect a sql*plus session to an oracle server?
What is meant by <> in sql?
What is the reports view in oracle sql developer?