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 / rakesh prasad

In Sql server 2005

select col + '('+ cast (count(col)as varchar(1000))+')'from
tablename group by col

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List out some of the requirements to set up a sql server failover cluster?

547


How do you trace the traffic hitting a sql server?

619


How do I find the sql server database version?

534


What is update locks?

514


What have included columns when we talk about sql server indexing?

581






Explain Normalization and DE normalization

610


What are pessimistic lock and optimistic lock?

550


What is the maximum size of a row in sql server?

529


Does table partitioning improve performance?

536


Do you know how to implement service broker?

539


What are the basic functions for master, msdb, model, tempdb databases?

594


Can we call stored procedure in trigger?

554


How to override dml statements with triggers?

583


How to stop log file growing too big?

580


What are the pros and cons of putting a scalar function in a queries select list or in the where clause?

730