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
Can we rollback after truncate?
Why do we use sqlite?
What is a call statement? Explain with an example.
Is left join inner or outer?
How to fetch alternate records from a table?
What is the most important ddl statements in sql are?
How we can update the view?
mention if it is possible to import data directly from t-sql commands without using sql server integration services? If yes, what are the commands? : Transact sql
What is cursor and why it is required?
How many types of cursors supported in pl/sql?
What is normalisation and its types?
what is rdbms? : Sql dba
table structure: ---------------- col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10 01-mar-2012 11:12:46 01-mar-2012 11:11:23 Write a query to display the result as shown below: col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10
What does the sign mean in sql?
how to use myisamchk to check or repair myisam tables? : Sql dba