if we have a column (Key) in a table.
and values of that column is
Key
1
1
1
2
2
3
3
4
4
5
5
5
and we want to show the data after query..like..
1(3)
2(3)
3(2)
4(2)
5(3)
how many times a single term comes..
Answer Posted / pradip jain
select convert(varchar,key) + '('+ convert(varchar,
count(key))+')' from table_name group by key
Hanamesh, why top 20?
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Explain what are the restrictions while creating batches in sql server?
How to remove duplicate rows from table except one?
What specific conditions database should meet, before you can bulk copy data into it using bcp?
what is the difference between them (ethernet networks and token ring networks)? : Sql server database administration
What are statistics?
What is the difference between left and right outer join?
How do you check sql server is up and running?
how can a database be repaired? : Sql server administration
What do I need to start working with sql studio? : sql server management studio
What are the types of table?
What are the database roles? : sql server security
What is rs.exe utility?
What is the new security features added in sql server 2014? : sql server security
What are the new scripting capabilities of ssms? : sql server management studio
Explain what are the events recorded in a transaction log?