CTE (Common Table Expression):
WITH name (Alias name of the retrieve result set fields)
AS
(
//Write the sql query here
)
SELECT * FROM name
CTE 1: Simple CTE
WITH ProductCTE
AS
(
SELECT ProductID AS [ID],ProductName AS [Name],CategoryID AS [CID],UnitPrice AS [Price]
FROM Products
)
SELECT * FROM ProductCTE
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment