I need help writing a sql stmt. Here’s what I’m trying to do:
See attachement pic for tables
I need to get the sum of sales and cost between two week # (say between week 48 of 2005 and week 2 of 2006), grouped by dept.
I know I have to look up the dates in the calendar table, in order to use a bigger than and lesser than ..date.
I didn’t put all the weeks in this example, but the table has 80,000 lines, so they’re all there. Same with the calendar, I have all dates.
Can some of you sql guru give me a hand? Can’t be that difficult but I’m stuck with this and nothing I’ve tried works.