重要なお知らせ

「教えて! goo」は2025年9月17日(水)をもちまして、サービスを終了いたします。詳細はこちら>

【GOLF me!】初月無料お試し

以下3つのSQLを実行した場合に検算が
合わないのですがどのように解釈して
いいのでしょうか。
(1)の件数+(2)の件数 = (3)の件数になると
考えては駄目ですか?

(1)
select count(A.*)
from tbl_a A,tbl_b B
where A.komoku1 = B.komoku1
and A.komoku2 = B.komoku2
and A.komoku3 = B.komoku3

(2)
select count(A.*)
from tbl_a A,tbl_b B
where A.komoku1 = B.komoku1
and A.komoku2 = B.komoku2
and A.komoku3 <> B.komoku3

(3)
select count(A.*)
from tbl_a A,tbl_b B
where A.komoku1 = B.komoku1
and A.komoku2 = B.komoku2

A 回答 (1件)

koumoku3にナル値が入っている場合は、(1)+(2)=(3)とはなりません。


ナル値が入っている行数をxとすると、(1)+(2)+x=(3)になります。
    • good
    • 0
この回答へのお礼

すみません。
お礼が遅くなりました。

まさに回答通りでした。
有難うございました。

お礼日時:2006/12/08 17:54

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!

関連するカテゴリからQ&Aを探す