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
What is application role in sql server database security? : sql server security
what is the difference between Delete and Truncate command in SQL
what is normalization? Explain different levels of normalization? : Sql server database administration
How to retrieve error messages using mssql_get_last_message()?
How to drop existing views from a database in ms sql server?
Tell me what is the order in which the sql query is executed?
Where the sql logs gets stored? : sql server database administration
Explain about the command-line tool SQLCMD?
Why use “in” clause in sql server?
what data regions are and what are the different data regions?
What are scheduled tasks in sql server?
What is the difference between a local and a global temporary table?
Explain active/passive and active/active cluster configurations?
What is difference between delete & truncate commands?
What is multi-statement table-value user-defined function?