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
How to include date and time values in sql statements?
What are some of the pros and cons of not dropping the sql server builtinadministrators group? : sql server security
What is an example of a foreign key?
What is data modeling and Reterminal integrity?
What is the difference between the 2 operating modes of database mirroring?
Explain features and concepts of analysis services?
Why is the need for data conversion transformations?
how to control the amount of free space in your index pages? : Sql server database administration
What are the general features of sql server management studio? : sql server management studio
How to start sql server browser service?
How many null values we can have in a unique key field in sql server?
What are triggers in ms sql server?
what are cursors? : Sql server database administration
what are database files and filegroups? : Sql server database administration
How do you maintain database integrity where deletions from one table will automatically cause deletions in another table?