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 / madhu sudhan g

Hiiiii

Lets the table name is No1 having column A is of int data Type
Now the query is
select convert(nvarchar(5),A) + '(' +
convert(nvarchar(5),count(1))+')' from NO1 GROUP BY A

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 the difference between NOROW and LOCKROW?

2253


What is the full meaning of dml?

534


What are the triggers in sql?

563


Explain a join?

627


How to delete existing triggers using "drop trigger"?

572






Tell me about builtinadministrator?

570


How to use column default values in insert statements in ms sql server?

536


How to apply cascading referential integrity in place of triggers?

585


What are the dmvs?

577


Can you name a few encryption mechanisms in sql server?

547


What are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture

577


What is sql server profiler trace data file?

593


What is identity?

567


What is index, cluster index and nonclustered index?

524


What is an expensive query?

544