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
Is sql pronounced sequel or sql?
What is difference between ms sql and mysql?
Explain the difference between sql and mysql.
Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?
Why is a trigger used?
What is denormalization in a database?
describe transaction-safe table types in mysql : sql dba
Can instead of triggers be used to fire once for each statement on a view?
i have 2 table table one 4 columns respective values a1 7,a2 6,a3 8 ,a4 12 & table two 4 colums respective values a1 7,a2 6,a3 8,a4 15.if table one & table two 3 colums same then 4th column values 1)Qes diff >5 then print 5 * diff value 2)Que diff <5 print 5
Why stored procedure is faster than query?
What are the different types of a subquery?
What will you get by the cursor attribute sql%found?
What happens when a trigger is associated to a view?
What do you mean by dbms? What are its different types?
What is a recursive join sql?