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

What is a View ? Can we insert, Update and delete a view?

631


What is tablesample?

578


What are the different methods available under sqlcommand class to access the data?

695


What is ms sql server triggers?

540


Why do we need normalization?

497






How to replace null values in expressions using isnull()?

649


How to change the data type of an existing column with "alter table" statements in ms sql server?

534


How to disable stored procedure sql server?

965


What are parameterized reports?

160


List some case manipulation functions in sql?

599


Can you pass expressions to function parameters?

546


How to stop log file growing too big?

580


Explain about integration services of Microsoft SQL server?

592


What are sub reports?

151


What are the benefits and tasks of object explorer? : sql server management studio

611