I need help to finish developing a consultation in SqlServer Database=Northwind pleasee Help friends RRS feed

  • Question

  • It should show the 5 most expensive pair orders, which are issued in the odd months of the selected employee, showing the results for the total order issued

    I need to find the 5 most expensive total orders

    I leave here my progress , please help me :

    CREATE PROC SP_5_Orders_more_expensive
    @EmployeeID int 
    select TOP(5)O.OrderID,CONVERT(varchar,O.OrderDate,103)as OrderDate,
    O.Freight,DATENAME(MONTH,O.OrderDate)as Meses,SUM(D.Quantity*D.UnitPrice)as 'Total' 
    from Orders O inner join [Order Details Extended] D on O.OrderID=D.OrderID 
    WHERE O.EmployeeID=@EmployeeID
    GROUP BY O.OrderID,O.OrderDate,O.Freight
    HAVING O.OrderID%2='0' and month(O.OrderDate)%2<>'0'

    Exec SP_5_Orders_more_expensive '4'

    ::Observation using northwind database::


    Sunday, December 29, 2013 5:43 PM