Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Every Week Number in a Year

$
0
0

I want to display the week number for every year starting with 2013 and going forward.  I have an Order Detail table that contains the following:

OrderNbr, RequestedShipDate, Item, Quantity

I'm trying to create a sql view that will have the following:

Item, Quantity, WeekNbr, Year1

My Order Detail table only has records in it for a few weeks but I want to see every week in the year and then in my quantity field I will fill it with 0 when there is not an order for that week/year combination.

So the result set would look something like this:

Item, Quantity, WeekNbr, Year1

ABC, 0, 1, 2014

ABC, 0, 2, 2014

ABC, 8, 3, 2014

and so on.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>