His own ideas more than half a month, also can not find method; Put it on the Internet, hope to get everybody's help! This is data and form style, hope access query can also achieve such effect, would appreciate
(CSDN can't upload attachments?
CodePudding user response:
SELECT material name, specification, the iif (shipper="B", the use of party, shipper) AS the shipper or use,
Use the SUM (iif (="B" and number)) AS B into total number, the SUM (iif (shipper="B", quantity)) AS B out of the total number of
Use the SUM (iif (="B", the number, 0)) - the SUM (iif (shipper="B", quantity, 0)) AS B remaining
FROM material query
GROUP BY material name, specification, the iif (shipper="B", the use of party, shipper)
The ORDER BY material name;