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 / hanamesh havale

select top 10 cast(key as varchar)
+ '(' + cast(count(key) as varchar) + ')'
from TableName
group by key


Hanamesh Havale
Influx Infotech

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a non equi join?

733


While you are inserting values into a table with the insert into .. Values option, does the order of the columns in the insert statement have to be the same as the order of the columns in the table?

786


How to backup SQL Server Reporting Services ?

122


How to get the definition of a user defined function back?

805


How to replace the Query Result 'Null Value' with a text ?

766






How does the report manager work in SSRS?

131


What is the primary use of the model database?

796


Tell me what is difference between view and materialized view?

697


How we can refresh the view?

793


Tell me when is the update_statistics command used?

704


What is sql server replication? : sql server replication

692


What is the benefit of normalization?

788


Why functions are used in sql server?

669


Find nth lowest salary or get nth lowest salary?

796


List the different normalization forms?

713