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
Can an entity have two primary keys?
Can the query output be sorted by multiple columns in ms sql server?
How to use union to merge outputs from two queries together in ms sql server?
What are the differences between stored procedure and the dynamic sql?
How to divide query output into multiple groups with the group by clause in ms sql server?
How to create nested stored procedure?
Types of Authentications in Sql Server? How user gets authenticated through windows authentication?
What is the stuff?
Different types of keys in SQL?
What is difference between clustered and non clustered index?
What are the new features are introduced in sql server 2012 reporting services?
What is perspective, have you ever created perspective? : sql server analysis services, ssas
is there a column to which a default can't be bound? : Sql server database administration
Explain the properties of subqueries in sql server?
How to create user messages with print statements in ms sql server?