Created
December 21, 2010 19:10
-
-
Save mhayes/750394 to your computer and use it in GitHub Desktop.
Common table expression usage in SQL Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE AdventureWorks2008; | |
WITH ShippingTime(OrderDate,ShipDate,DaysToShip) AS | |
( | |
SELECT OrderDate, ShipDate,DATEDIFF(day,OrderDate,ShipDate) | |
FROM Sales.SalesOrderHeader | |
) | |
SELECT * | |
FROM ShippingTime; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment