下面是我试图创建的一个表组件的示例。
这是我目前正在尝试的查询(未成功)。这三张table是wp\u ko、rack和bt\u runin。我遇到的问题是标签为“result”的列的和。我想在“结果”一栏显示“体积”一栏中加减法的平衡。
SELECT StartTime, name, Lot, fv, koVol/31 AS Volume, SUM(koVol/31) AS Result
FROM wp_ko
WHERE fv = 11 AND name = "SEZI" AND lot LIKE "1007%"
UNION
SELECT StartTime, destName, destLot, dest, TotVol, SUM(TotVol)
FROM rack
WHERE dest = 11 AND destname = "SEZI" AND destlot LIKE "1007%"
UNION
SELECT StartTime, srcName, srcLot, Source, TotVol*-1, SUM(TotVol*-1)
FROM rack
WHERE Source = 11 AND srcName = "SEZI" AND srcLot LIKE "1007%"
UNION
SELECT StartTime, Name, Lot, fv, Total_Bls*-1, Total_Bls*-1)
FROM bt_runin
WHERE fv = 11 AND Name = "SEZI" AND Lot LIKE "1007%"
这是我得到的结果表。
1条答案
按热度按时间iszxjhcz1#
我在一个朋友的帮助下想出了这个办法。下面是有效的查询,下面是结果表的pic。