SQL Server数据库
CREATE TABLE "KK" AS SELECT
*
FROM
(
SELECT
"路线编码",
SUM (
CAST ("隐患里程" AS float4)
) AS "隐患"
FROM
"BP03-安保工程审核库"
GROUP BY
"路线编码"
) A,
(
SELECT
"路线编号",
CAST ("隐患里程" AS float4)
FROM
"BP03闫"
) B
WHERE
A ."路线编码" = B."路线编号"
AND (
A ."隐患" = B."隐患里程"
OR A ."隐患" <> B."隐患里程"
);