Home > DeveloperSection > Forums > Sub Queries In sql Server
Ankit Singh

Total Post:341

Posted on    December-03-2015 9:42 PM

 Database SQL Server  SQL  SQL Server 2008  SQL Server 2012 

 1 Reply(s)
 488  View(s)
Rate this:
I Want to use subQuery in Sql server please help me.

aditya kumar Patel

Total Post:254

Posted on    December-03-2015 9:45 PM

A Subquery or Inner query or Nested query is a query within another SQL query and embedded within the WHERE clause.

A subquery is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved.

Subqueries can be used with the SELECT, INSERT, UPDATE, and DELETE statements along with the operators like =, <, >, >=, <=, IN, BETWEEN etc.

SELECT * FROM Employee WHERE Emp_ID IN (SELECT Emp_ID FROM Employee WHERE Emp_Sal > 1000)

Don't want to miss updates? Please click the below button!

Follow MindStick