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 / vinu
select decode (col1,'a','a','b','b','others') col1,count(col1) from T1 group by decode (col1,'a','a','b','b','others')
Is This Answer Correct ? | 9 Yes | 2 No |
Post New Answer View All Answers
What is full join?
How delete all data from all tables in sql?
Is pl sql a scripting language?
What is a nested table in word?
When is a declare statement required?
Is sqlite thread safe?
How do I write a cron which will run a sql query and mail the results to agroup?
What is the difference between clustered and non-clustered index in sql?
how can we know the number of days between two given dates using mysql? : Sql dba
Can we use ddl statements in stored procedure sql server?
write an sql query to get third maximum salary of an employee from a table named employee_table. : Sql dba
How do I tune a sql query?
Explain the commit statement.
What are joins in sql?
What programs use sql?