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 / saravanan p

Select cast(idKey as varchar)+'('+cast(count(idKey) as
varchar)+')'
from #tbl1 group by idKey

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain indexed views?

551


what happens on checkpoint? : Sql server database administration

500


How do you delete a data source?

535


How do you debug a procedure in sql server?

489


What is the difference between createstatement and preparedstatement?

483






Suppose you want to implement the following relationships while designing tables. How would you do it?a.) One-to-oneb.) One-to-manyc.) Many-to-many

514


How many triggers you can have on a table?

527


What is used to replicate sessions between instances in coldfusion clusters?

572


How to use the inserted and deleted pseudo tables?

535


What are the different types of join?

558


What are commit and rollback in sql?

558


Define full outer join in sql server joins?

493


can a database be shrunk with users active? : Sql server administration

556


Explain the various types of concurrency problem. I.e. Lost or buried updates, uncommitted dependency, inconsistent analysis, phantom read?

497


How to create a trigger for insert only?

593