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 / devraj

Table Str:- create table T
( COL1 NUMBER(2));

Data:- select * from t;
col1
1
1
1
2
2
3
3
4
4
5
5
5
Query:-
Select col1 || '(' || Count(col1) || ')' From t Group By
col1;

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you create a clustered index?

714


Tell me what are cursors and when they are useful?

704


Your sql server is running out of disk space. You notice that there are several large files with ldf extensions what are these files?

810


Explain difference between control flow and data flow?

715


How many types of triggers in sql server?

713






What is difference between temp table and cte?

721


How to count groups returned with the group by clause in ms sql server?

740


What is policy based management (pbm)? : sql server database administration

742


Explain the concept of recursive stored procedure.

666


How to display a past time in days, hours and minutes?

743


Difference between primary key and clustered index?

686


What is trigger in salesforce?

674


Describe in brief sql server monitoring ways.

754


What is ms sql server triggers?

705


Do you know what is lock escalation?

771