Rayne
asked on
TSQL Help Missed Rows
Hello Gurus
There is a table called originalData that holds item specific information at a week level. There is a column called WeekTY.
Now I need a TSQL that does the following>>
There is another table called total end to end weeks that holds the number of total possible week values.
So, the sql simply looks for any combination of item + week that is NOT present in the originalData table and then adds them to the same table in this manner >>
if item1+Week2 combination is missing in the originalData table, the sql basically duplicates all the row data for the combination of item1 + week1 but put zeroes for weekTY column only
Please see the attached. Tab “originalData” has the original rows and the tab “addedRows” has the entire data with the added new rows for the missed item + week combination
tsqlIssue.xlsx
There is a table called originalData that holds item specific information at a week level. There is a column called WeekTY.
Now I need a TSQL that does the following>>
There is another table called total end to end weeks that holds the number of total possible week values.
So, the sql simply looks for any combination of item + week that is NOT present in the originalData table and then adds them to the same table in this manner >>
if item1+Week2 combination is missing in the originalData table, the sql basically duplicates all the row data for the combination of item1 + week1 but put zeroes for weekTY column only
Please see the attached. Tab “originalData” has the original rows and the tab “addedRows” has the entire data with the added new rows for the missed item + week combination
tsqlIssue.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you all
ASKER
Thank you all
Portlet Paul's solution was closest to what looked for
Portlet Paul's solution was closest to what looked for
ASKER
Here is a follow up with new question
https://www.experts-exchange.com/questions/28493334/Access-Doable.html
https://www.experts-exchange.com/questions/28493334/Access-Doable.html
ASKER
it sql server 2010