我有以下兩個表SQL和運營工作不正常
LandParcels表
Blockid ParcelNo storPri
======= ======== =======
52000105 3 State
52000105 4 Private
52000105 5 State
操作表
Blockid ParcelNo ActionTaken
======= ======== ===========
52000105 3 Received
52000105 3 Send to Computer
52000105 4 Received
52000105 5 Received
我想找到的記錄Received
但不Send to Computer
這是我的查詢
select
l.blockid, l.parcelno
from
landparcels l
left join
actions ac on l.blockid = ac.blockid and l.parcelno = ac.parcelno
where
ac.actiontaken = 'Received'
and ac.actiontaken <> 'Send to Computer'
and ac.blockid = 52000105
結果是
Blockid ParcelNo
======= ========
52000105 3
52000105 4
52000105 5
我想ParcelNo 4和5
規範化的動作表,然後。 – Mchl 2011-01-09 08:34:12
@Mchl,是什麼讓你說它沒有正常化? – Ronnis 2011-01-09 08:37:22
你正在使用什麼數據庫**?該數據庫的哪個版本? – 2011-01-09 09:36:48