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 / vikas kant

select key,count(key1) from [table_name]
group by key

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

OPTIMIZATION OF SP,CURSOR,TRIGGERS

2426


How to create a view with data from multiple tables?

797


How to deploy the Report?

107


How do you clear a log file?

740


How to insert data with null values?

792


Using the customer, and order table in northwind database, please write a query to produce xml?

870


What the difference between UNION and UNIONALL?

797


Difference between Inner vs outer joins?

724


How to use user defined functions in expressions?

762


What is the difference between writing data to mirrored drives versus raid5 drives

719


Can sql server 2016 run on windows 7?

700


How many replicas are maintained for each sql azure db?

118


Can we deploy SSRS reports on our personal website?

150


Do you think BCNF is better than 2NF & 3NF? Why?

1027


What protocol does sql server use?

725