Skip to content

Instantly share code, notes, and snippets.

@ArCiGo
Created May 19, 2019 22:29
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 ArCiGo/2c8e62d4c2c253475577762741fe0bf5 to your computer and use it in GitHub Desktop.
Save ArCiGo/2c8e62d4c2c253475577762741fe0bf5 to your computer and use it in GitHub Desktop.
SELECT ord.OrderNumber,
ord.TotalAmount,
cus.FirstName,
cus.LastName,
cus.City,
cus.Country
FROM Customer cus
LEFT JOIN [ORDER] ord ON cus.Id = ord.CustomerId
ORDER BY ord.TotalAmount;
GO
/** Output **/
OrderNumber TotalAmount FirstName LastName City Country
----------- --------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ----------------------------------------
NULL NULL Diego Roel Madrid Spain
NULL NULL Marie Bertrand Paris France
542912 12.50 Patricio Simpson Buenos Aires Argentina
542937 18.40 Paolo Accorti Torino Italy
542897 28.00 Pascale Cartrain Charleroi Belgium
542716 28.00 Maurizio Moroni Reggio Emilia Italy
543028 30.00 Yvonne Moncada Buenos Aires Argentina
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment