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 / krishna reddy l

select convert(varchar(5),ex)+'('+convert(varchar(5),count
(ex))+')' from example group by ex
Table name example and columna name ex

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is resultset concur_updatable?

752


What is user defined datatypes and when you should go for them?

773


What are the advantages to use stored procedures?

794


Can you please differentiate between a primary key and a unique key?

733


How to select some specific rows from a table in ms sql server?

765


Where are sql server usernames and passwords stored in the sql server?

800


How many databases instances are there in sql server 2000?

761


How raid can influence database performance?

759


Define self join in sql server joins?

710


what is the difference between openrowset and openquery?

764


What are the differences between stored procedure and view in sql server?

847


How to create new tables with "select ... Into" statements in ms sql server?

690


When we should use @@error?

709


Write a query to include a constraint, to check whether the employee salary is greater than 5000?

1358


Can a function call a stored procedure in sql server?

707