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


Please Help Members By Posting Answers For Below Questions

How you can get a list of all the table constraints in a database?

507


What are the fixed server level roles? : sql server security

540


why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it? : Sql server administration

545


How to include date and time values in sql statements?

626


Explain the dbcc pintable command when would you use it?

498






How to make conditional sum in ssrs?

128


What are the new features are introduced in sql server 2012 reporting services?

105


What is the difference between local and global temporary tables?

576


What is 1nf 2nf and 3nf?

484


What is partition index in sql server?

602


How extra digits are handled with numeric data type literals?

517


What is save transaction and save point?

615


Mention the differences between local and global temporary tables.

558


Who is the owner of a schema in ms sql server?

540


What protocol does sql server use?

510