Created
August 15, 2018 07:22
-
-
Save mikebrind/a261f0778d01dcb09d49862619e8778b to your computer and use it in GitHub Desktop.
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
create view OrderHeaders as | |
select c.Name as CustomerName, | |
o.DateCreated, | |
sum(oi.Price) as TotalPrice, | |
count(oi.Price) as TotalItems | |
from OrderItems oi | |
inner join Orders o on oi.OrderId = o.OrderId | |
inner join Customers c on o.CustomerId = c.CustomerId | |
group by oi.OrderId, c.Name, o.DateCreated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment