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 is bulk bind
what is a relationship and what are they? : Sql dba
what are the forced views
Difference between views and materialized views?
Describe different types of general function used in sql?
How can we link a sql database to an existing android app?
How to start the command-line sql*plus?
If I have a table T with 4 rows & 2 columns A & B. A has values 1,2,3,4. and B has 10,20,30,40. Write an Update SQL query which can Swap the values of A & B for all records. (Do not use a sub-query)
how to create a new view in mysql? : Sql dba
how to drop an existing table in mysql? : Sql dba
What is Highwatermark?
Does access use sql?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)