SELECT ( ( SELECT CAST(value AS INT) FROM param a ) - ( SELECT CAST(value AS INT) FROM param b ) ) FROM ( SELECT fid , value FROM param WHERE int_id = 1 ) a INNER JOIN ( SELECT fid , value FROM param WHERE int_id = 2 ) b ON a.fid = b.fid
[其他解释] 图在何处 ? [其他解释] 晴天大大,你网速有问题,我能看到图 [其他解释] 这样? select int_id,fid,sum(case when int_id=1 then value else -value end)as v from tb group by int_id,fid [其他解释] 这里value是varchar类型 但是这样还会报错 select ((select CAST(value as int) from param a) - (select CAST(value as int) from param b)) (select fid,value from param where int_id=1) a inner join(select fid,value from param where int_id=2) b on a.fid=b.fid