我想知道如何编写SQL语句来判断A表的行数等于B表的行数?
问问题
57 次
2 回答
2
查询以下
SELECT 1
FROM
(SELECT COUNT(1) TOTAL_A FROM A) TABLE_A_COUNT,
(SELECT COUNT(1) TOTAL_B FROM B) TABLE_B_COUNT
WHERE TABLE_A_COUNT.TOTAL_A = TABLE_B_COUNT.TOTAL_B
如果计数匹配,它将返回一行。
于 2013-07-12T07:45:29.497 回答
0
if (select count(*) from a) = (select count(*) from b)
begin
:
end
于 2013-07-12T07:45:23.953 回答