SELECT c.仓库, c.品名, c.实盘数, d.帐面数, (c.实盘数-d.帐面数) AS 差额
FROM [SELECT a.仓库, a.品名, Sum(a.数量) AS 实盘数
FROM 实盘数 a
GROUP BY a.仓库, a.品名]. AS c LEFT JOIN [SELECT b.仓库, b.品名, Sum(b.数量) AS 帐面数
FROM 帐面数 b
GROUP BY b.仓库, b.品名]. AS d ON (c.品名 = d.品名) AND (c.仓库 = d.仓库)
WHERE (c.实盘数-d.帐面数)<>0;