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 / vikneswaran
select decode(col1,'a','a','b','b','Other') "col1",count
(col1) "countval"
from col group by col1;
Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
Which sql statement is used to delete data from a database?
What is sp_helptext?
How will you distinguish a global variable with a local variable in pl/sql?
how can we know the number of days between two given dates using mysql? : Sql dba
What is sql lookup?
How to run pl sql program in mysql?
Explain what is a field in a database and record in a database?
what is sql server agent? : Sql dba
What is a sql trace file?
Can a select statement fire a trigger?
Is time a data type in sql?
what is commit? : Sql dba
What is #table in sql?
Explain the difference in execution of triggers and stored procedures?
What is the difference between left outer join and left join?