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
Explain ttitle and btitle.
How many sql core licenses do I need?
What is row_number () in sql?
What is record variable?
What is a nested table in word?
Which normal form is best?
what is the difference between clustered and non clustered index in sql? : Sql dba
What is percent sign in sql?
Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql
What are different sql data types?
what are the 'mysql' command line arguments? : Sql dba
Can we join more than 2 tables in sql?
differentiate between float and double. : Sql dba
How do you declare a user-defined exception?
Why plvtab is considered as the easiest way to access the pl/sql table?