Thursday, September 19, 2013

most frequently used sql queries




In the SQL query frequently most of the developers used the below query’s for day to day needs.


Get the top Nth value in the table.
--Get top 3 rd value
select min (salary) from EmpTable where Salary in (select top 3 salary from EMPTable)

How to select duplicate records in SQL.

--Select Duplicate value
select CName,count(*) from MyTable group by CName having count(*) >1

How to DELETE duplicate value from the Data TABLE using SQL Query.

--Delete dublicate value
delete from MyTable where ID not in(select MIN(ID) from MYTable group  by CName)

1 comment:

zaidajaggard said...

Best Casino In Reno | MapYRO
Discover the best casinos in Reno. you can now 의정부 출장마사지 play a 여수 출장안마 wide variety 삼척 출장마사지 of games, with great bonuses and 서산 출장샵 lots of fun to play online. 광명 출장안마