请参阅以下有关我的问题的说明。我有2张桌子。
SELECT LocationsOFproducts.[Bay no]
,LocationsOFproducts.[Product Code]
,LocationsOFproducts.LocationQTY
,SumDatahistoryQuery.SumOfQTY
,([LocationQTY]) + ([SumOfQTY]) AS TOTALQTY
FROM LocationsOFproducts
INNER JOIN SumDatahistoryQuery ON (LocationsOFproducts.[Product Code] = SumDatahistoryQuery.[Product Code])
AND (LocationsOFproducts.[Bay no] = SumDatahistoryQuery.[Bay no])
AND (LocationsOFproducts.[Product Code] = SumDatahistoryQuery.[Product Code])
GROUP BY LocationsOFproducts.[Bay no]
,LocationsOFproducts.[Product Code]
,LocationsOFproducts.LocationQTY
,SumDatahistoryQuery.SumOfQTY
,([LocationQTY]) + ([SumOfQTY])
ORDER BY LocationsOFproducts.[Product Code];
QUERY2: TOTAL QTY - Counting how many products left in some location after stock movement
SQL代码:
~/.ssh/authorized_keys
结果:
我希望结果有点不同。
我的查询应检查Datahistory表中的Bay no,产品代码和QTY是否还有更多值,如果不是我想用LocationOfproducts表中的数据填充该空间,并在SumOfQTY字段填写那些
值为0以在TOTALQTY列中进行求和。
请看下面我需要得到的内容:
Please see query what I need to get - I maked that in Photoshop by cutting and pasting fields:
谁能知道如何编写正确的查询?