Sunday 6 October 2013

11. Write a query to display the sales order ID and the territory name of the orders where the month of the order is May and the year is 2004.

select salesOrderID,Name from  sales.salesOrderHeader
s join sales.salesTerritory t on s.TerritoryID =t.TerritoryID
where DateName(mm, OrderDate)= 'May'and DatePart(yy,OrderDate)=2004

No comments:

Post a Comment