4 つの SQL Server データベース テーブルがあります。
inventory
inventory2
bdo
details
構造は次のとおりです。
在庫
AllocationID MSISDN
1 3018440225
2 3028431115
在庫2
AllocationID MSISDN
1 3011234567
2 3026440657
3 3454159650
BDO
BDO_ID BDO_MSISDN
1 3457076952
2 3005000475
詳細
AllocationID MSISDN
3 3454159650
次に、次のクエリからレコードを取得する必要があります。
select a.msisdn, b.bdo_id
from details a, bdo b, inventory c, inventory2 d
where
a.msisdn = 3454159650
and (a.allocationid = c.allocationid) or (a.allocationid = d.allocationid)
and (c.bdo_id = b.bdo_id) or (d.bdo_id = b.bdo_id)
このクエリは複数の結果を返します (すべてまったく同じです) なぜそうなのですか? 私が間違っている場合は、私の概念とクエリを修正してください。