Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to do some calculations on data and cannot have null values.
The original data set contains: Part, Date, & Qty
But not every part was sold on every date. So I split the data into two tables: one containing all possible parts the other containing all possible dates.
Now how can I create a table that contains both?
Pseudo code below:
Data:
Load
Part & '|' & Date as Part|Date,
Part,
Date,
Qty;
Table A:
Load Distinct
Part
Resident Data;
Noconcatenate
Table B:
Load Distinct
Date,
0 as ZeroQty
Resident Data;
Help needed
Table C:
Load
Part|Date
ZeroQty;
Left Join(Table C)
Load
Part|Date,
Part,
Date,
Qty;
Resident
Data;
Drop Table Data;
Noconcatenate
Final Result:
Load
Part|Date,
Part,
Date,
ZeroQty + Qty as TotalQty
Resident
Table C;
Drop Table C;
can you give us some more details.
You are correct. However, "A" is a possible part and "H" is a possible attribute and therefore a valid data point. What I am seeking is all possible combinations.
If we go back to thinking in terms of dates
| Part | Attribute | Qty |
| A | E | 3 |
| A | F | 1 |
| A | G | 1 |
| B | G | 6 |
| B | H | 3 |
is equal to
| Part | Date | Qty |
| A | 1/1/2016 | 3 |
| A | 2/1/2016 | 1 |
| A | 3/1/2016 | 1 |
| B | 3/1/2016 | 6 |
| B | 4/1/2016 | 3 |
Part A and Attribute H would be the Equivalent of Part A for the month of April. Part A and April exist, there were simply none sold.
Did you look at my response below? Re: Help with SQL