Laboratorium 3


select year(o.OrderDate),
(select Sum(Quantity*od.UnitPrice)from [Order Details] od, Orders o1, Products p where
o1.OrderID=od.OrderId and p.ProductID=od.ProductID and year(o.OrderDate)=year(o1.OrderDate) and
p.CategoryID='1') as "Beverages",

(select Sum(Quantity*od.UnitPrice)from [Order Details] od, Orders o1, Products p where
o1.OrderID=od.OrderId and p.ProductID=od.ProductID and year(o.OrderDate)=year(o1.OrderDate) and
p.CategoryID='2') as "Condiments",

(select Sum(Quantity*od.UnitPrice)from [Order Details] od, Orders o1, Products p where
o1.OrderID=od.OrderId and p.ProductID=od.ProductID and year(o.OrderDate)=year(o1.OrderDate) and
p.CategoryID='3') as "Confections",

(select Sum(Quantity*od.UnitPrice)from [Order Details] od, Orders o1, Products p where
o1.OrderID=od.OrderId and p.ProductID=od.ProductID and year(o.OrderDate)=year(o1.OrderDate) and
p.CategoryID='4') as "Dairy Products",

(select Sum(Quantity*od.UnitPrice)from [Order Details] od, Orders o1, Products p where
o1.OrderID=od.OrderId and p.ProductID=od.ProductID and year(o.OrderDate)=year(o1.OrderDate) and
p.CategoryID='5') as "Grains/Cereals",

(select Sum(Quantity*od.UnitPrice)from [Order Details] od, Orders o1, Products p where
o1.OrderID=od.OrderId and p.ProductID=od.ProductID and year(o.OrderDate)=year(o1.OrderDate) and
p.CategoryID='6') as "Meat/Poultry",

(select Sum(Quantity*od.UnitPrice)from [Order Details] od, Orders o1, Products p where
o1.OrderID=od.OrderId and p.ProductID=od.ProductID and year(o.OrderDate)=year(o1.OrderDate) and
p.CategoryID='7') as "Produce",

(select Sum(Quantity*od.UnitPrice)from [Order Details] od, Orders o1, Products p where
o1.OrderID=od.OrderId and p.ProductID=od.ProductID and year(o.OrderDate)=year(o1.OrderDate) and
p.CategoryID='8') as "Seafood"

from
Orders o
group by year(o.OrderDate)

Wyszukiwarka

Podobne podstrony:
Rola laboratoriów w świetle wymagań systemów zarządzania jakoscią
Laboratorium 3
Ćwiczenie laboratoryjne nr 6 materiały
Windows 2 Laboratorium 4b
Chemia żywnosciCwiczenie laboratoryjne nr 1 wyodrebnianie i badanie własciwosci fizykochemicznych b
LABORATORIUM CHEMIA I WYTRZYMALOSC MATERIALOW sprawko 1
Ustawa o medycznej diagnostyce laboratoryjnej
Laboratorium z PO Zestaw 05
diagnostyka laboratoryjna w okresie niemowlęcym i dziecięc…
Spis Laboratoriów
Program ćwiczeń laboratoryjnych

więcej podobnych podstron