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
Answers were Sorted based on User's Feedback
Answer / 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 |
What are database links used for?
SELECT flavor, SUM (ice_cream_sales) FROM sales_detail GROUP BY flavor ORDER BY 2 DESC If the "sales_detail" table contains ten records with different values in the flavor column (two "vanilla," three "chocolate," four "strawberry," and one NULL), how many rows are returned by the sample code above? 1. 0 rows 2. 1 row 3. 3 rows 4. 4 rows 5. 10 rows
how to calculate the difference between two dates? : Sql dba
i have a table like this. i want to output like this c1 c2 c1 c2 1 10 1 10 2 20 2 30 3 30 3 60 4 40 4 100 5 5 5 105 c1 and c2 are columns in a table .i want output like this c2 values are 10,10+20,10+20+30,10+20+30+40.10+20+30+40+5. write a sql query.pls help this i want urgent.
2 Answers IBM, Loginworks, OFSS,
What is meaning of <> in sql?
What are tuples in sql?
How is pl sql different from sql?
What is the fastest way of accessing a row in a table?
Is sql a backend?
what is 'force view'?
What is an emotional trigger?
Which is faster view or stored procedure?