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 decode(col1,'a','a','b','b','Other');
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How delete all data from all tables in sql?
How do you change a value in sql?
How delete a row in sql?
What is difference between function and trigger?
What is the purpose of design view?
Does varchar need length?
What is denormalization in a database?
What is spool?
What is the difference between stored procedure and view?
What is the cause of mutating table error and how can we solve it?
What are the two virtual tables available at the time of database trigger execution?
What is procedure explain with example?
- Types of triggers - View - Dcl - Procedures, packages, functions - Metasolve - Can use Dcl in triggers - package case study - Cursor and its types - triggers schedule - Wrap - Why we are using fetch and for in cursor. difference?
What are operators available in sql?
Why coalesce is used in sql?