dingleberry
Programmer
Hey All,
Question: I have two tables. One has dates:
[pre]WE Date
2/28/2015
3/7/2015
3/14/2015
3/21/2015
3/28/2015
4/4/2015
4/11/2015
4/18/2015[/pre]
One has Sales figures:
[pre]Store Dept UPC Description SUB_CATEGORY SumOfQty SumOfCost SumOfRetail $ WE Date
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 4 $3.88 $11.56 4/18/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 31 $30.07 $89.59 4/11/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 1 $0.97 $2.89 4/4/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 19 $18.43 $54.91 3/21/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 35 $33.95 $101.15 3/14/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 39 $37.83 $112.71 3/7/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 1 $0.97 $2.89 2/28/2015[/pre]
I can link on WE Date as a common field however if you look closely you will see no data for W/E 3/28 in the sales figures. With the following query, I can get all dates listed but of course because there is no sales data for W/E 3/28, the date shows up but all other fields are empty after running
Returns
[pre]WE Date UPC SumOfRetail $
2/28/2015 73314723576 $2.89
3/7/2015 73314723576 $112.71
3/14/2015 73314723576 $101.15
3/21/2015 73314723576 $54.91
3/28/2015
4/4/2015 73314723576 $2.89
4/11/2015 73314723576 $89.59
4/18/2015 73314723576 $11.56
[/pre]
But what I am hoping to achieve is for that row on w/e 3/28 to include the same sku and a value of 0 for SumOfRetail $.
Before I go, I should also include that there are multiple UPC's in the master database so just using a Nz([UPC],"73314723576") function would probably fail because any other UPC's that I have this issue for would then be populated with that string. I am wondering if there is a way that Access could populate it with the UPC as it's looping through that one UPC for all dates.
Question: I have two tables. One has dates:
[pre]WE Date
2/28/2015
3/7/2015
3/14/2015
3/21/2015
3/28/2015
4/4/2015
4/11/2015
4/18/2015[/pre]
One has Sales figures:
[pre]Store Dept UPC Description SUB_CATEGORY SumOfQty SumOfCost SumOfRetail $ WE Date
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 4 $3.88 $11.56 4/18/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 31 $30.07 $89.59 4/11/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 1 $0.97 $2.89 4/4/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 19 $18.43 $54.91 3/21/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 35 $33.95 $101.15 3/14/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 39 $37.83 $112.71 3/7/2015
3009 BAKERY 73314723576 BUN HAMBURGER WHITE BAKERY-CENTRAL-BUNS 1 $0.97 $2.89 2/28/2015[/pre]
I can link on WE Date as a common field however if you look closely you will see no data for W/E 3/28 in the sales figures. With the following query, I can get all dates listed but of course because there is no sales data for W/E 3/28, the date shows up but all other fields are empty after running
SQL:
SELECT dates.[WE Date], shrink.UPC, shrink.[SumOfRetail $ ]
FROM dates LEFT JOIN shrink ON dates.[WE Date] = shrink.[WE Date];
Returns
[pre]WE Date UPC SumOfRetail $
2/28/2015 73314723576 $2.89
3/7/2015 73314723576 $112.71
3/14/2015 73314723576 $101.15
3/21/2015 73314723576 $54.91
3/28/2015
4/4/2015 73314723576 $2.89
4/11/2015 73314723576 $89.59
4/18/2015 73314723576 $11.56
[/pre]
But what I am hoping to achieve is for that row on w/e 3/28 to include the same sku and a value of 0 for SumOfRetail $.
Before I go, I should also include that there are multiple UPC's in the master database so just using a Nz([UPC],"73314723576") function would probably fail because any other UPC's that I have this issue for would then be populated with that string. I am wondering if there is a way that Access could populate it with the UPC as it's looping through that one UPC for all dates.