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

How can you tell if a database object is invalid?

619


What is transactional replication?

561


If a stored procedure is taking a table data type, how it looks?

5804


What is a covered index?

521


What is the cpu pressure?

565






What happens when converting big values to integers?

570


What is a partition function in sql server?

537


Find nth lowest salary or get nth lowest salary?

597


Explain the collation?

625


What is sql collation?

655


hi, how to link a text file and a .rpt file in my tables of sql server and to retrieve those records for further use. reply me as soon as possible.

1560


How to use transact-sql statements to access the database engine?

539


What is the rdl file?

88


what is a mixed extent? : Sql server administration

607


What are acid properties of transaction?

553