Skip to content

Instantly share code, notes, and snippets.

@karenpayneoregon
Created July 10, 2020 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karenpayneoregon/bc8329737eee80dfd2f9df0f9d3dbc63 to your computer and use it in GitHub Desktop.
Save karenpayneoregon/bc8329737eee80dfd2f9df0f9d3dbc63 to your computer and use it in GitHub Desktop.
Get order by order id
DECLARE @OrderIdentifier INT= 10248;
SELECT O.OrderID,
O.CustomerIdentifier,
O.EmployeeID,
E.Title + ' ' + E.FirstName + ' ' + E.LastName AS Employee,
O.OrderDate,
O.RequiredDate,
O.ShippedDate,
O.ShipVia,
O.Freight,
O.ShipAddress,
O.ShipCity,
O.ShipRegion,
O.ShipPostalCode,
O.ShipCountry
FROM Orders AS O
INNER JOIN Employees AS E ON O.EmployeeID = E.EmployeeID
WHERE O.OrderID = @OrderIdentifier;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment