Question = my employees on the base of money maximum which product was sold.With EmployeeID
Answer =
EmployeeID ProductID Total
----------- ----------- ----------------------
1 38 23570,0749511719
2 38 25190,5999755859
3 38 25559,5
4 38 29432,9499511719
5 59 7584,5
6 59 6671,5
7 38 16695,3603515625
8 29 9244,82507324219
9 38 14624,25
(9 row(s) affected)
i tried but it's wrong
WRONG
select e.EmployeeID,Count(OD.ProductID),Sum(OD.UnitPrice*Quantity *(1-Discount)) as ToplamFiyat from Orders as o
inner join [Order Details] as OD on OD.OrderID=o.OrderID
inner join Employees as e on e.EmployeeID=o.EmployeeID
inner join Products as p on p.ProductID=OD.ProductID
group by e.EmployeeID
order by 1
WRONG
select e.EmployeeID,OD.ProductID,Sum(OD.UnitPrice*Quantity *(1-Discount)) as ToplamFiyat from Orders as o
inner join [Order Details] as OD on OD.OrderID=o.OrderID
inner join Employees as e on e.EmployeeID=o.EmployeeID
inner join Products as p on p.ProductID=OD.ProductID
group by e.EmployeeID,OD.ProductID
order by 1
PLS HELP :)
[edit]Code block added - OriginalGriff[/edit]