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

Best Practice in Scenario

$
0
0

I am currently trying to accomplish the following:

get the Last Weekstamp for the last 6 Months, the following ilustrates how the end result might look like:

Month   | Weekstamp |
2013-12|  2013-52    |
2014-01|  2014-05    |

.... and so on

I have a auxiliary Table, which has all Weeks in it and allows me to connect to a Calender Table, which in turn has all months, meaning i am able to get all weekstamps per Month,

but how do i get all of the Last Week Numbers for the Last 6 Months ? my idea was a Temporary table of some sor (never used one, am a beginner when it Comes to SQL) which calculates all of the Weekstamps needing to be filtered out per month, and than gives out only values which i could than use to filter a query which contains all the data i Need.

Anybody have a better idea?

As i said I am just a beginner so i can't really say what the best way would be

Thanks a lot in Advance!


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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