Common Table Expression(CTE) Example

CGN007
Posted by CGN007 under Sql Server category on | Points: 40 | Views : 968
With EmployeeCTE
AS
(
SELECT E.emp_id AS [Employee ID],ED.emp_name AS [Employee Name],E.emp_salary AS [Salary]
FROM employee E
JOIN employeeDetails ED
ON E.emp_id = ED.emp_id
)
SELECT * FROM EmployeeCTE


Here employee details will be retrieved and stored as temporary result set in the EmployeeCTE.
We can use the result to query like a table/view.

Comments or Responses

Posted by: Sqldev on: 3/11/2013 Level:Starter | Status: [Member] | Points: 10
Hi,

Below video have complete information about CTE like what is CTE , properties of CTE and examples for CTE in sql server.

http://www.youtube.com/watch?v=Ly-YqPVdVOk&feature=youtu.be


Best Regards,
Sql Expert
http://learnsqltips.blogspot.com/

Login to post response