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

What is application role in sql server database security? : sql server security

556


what is the difference between Delete and Truncate command in SQL

629


what is normalization? Explain different levels of normalization? : Sql server database administration

656


How to retrieve error messages using mssql_get_last_message()?

534


How to drop existing views from a database in ms sql server?

533






Tell me what is the order in which the sql query is executed?

531


Where the sql logs gets stored? : sql server database administration

529


Explain about the command-line tool SQLCMD?

554


Why use “in” clause in sql server?

557


what data regions are and what are the different data regions?

101


What are scheduled tasks in sql server?

547


What is the difference between a local and a global temporary table?

626


Explain active/passive and active/active cluster configurations?

631


What is difference between delete & truncate commands?

552


What is multi-statement table-value user-defined function?

539