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 / pradip jain
select convert(varchar,key) + '('+ convert(varchar,
count(key))+')' from table_name group by key
Hanamesh, why top 20?
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Write the SQL query to drop, truncate and delete table.
Can a cursor be updated? If yes, how you can protect which columns are updated?
What are pages and extents? : SQL Server Architecture
Thanks to some maintenance being done, the sql server on a failover cluster needs to be brought down. How do you bring the sql server down?
what changed between the previous version of sql server and the current version? : Sql server database administration
Can two tables share the same primary key?
Define the one-to-one relationship while designing tables.
What is the maximum size of a dimension? : sql server analysis services, ssas
Explain datetime2 data type in sal server 2008?
What is log shipping? Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and we can use this as the DR (disaster recovery) plan.
What is the difference between rank and dense_rank?
Which is better statement or preparedstatement?
How does a profiler work?
Can another user execute your local temporary stored procedures?
Tell me what is de-normalization and what are some of the examples of it?