我正在使用MS Access
使用以下查询时,当“1”和“2”两个值(SMPHT_Med.StateCode
)与“A1”(Lookup2.StateCode
中)
此处SMPHT_LKP_ProOpt
是用于匹配SMPHQ_Active_Item
和SMPHT_Med
之间记录的查找表
基本上,当SMPHT_Med
的列中SMPHT_Med.StateCode
的列值为{1}时,SMPHT_LKP_ProOpt.State
中的“1”和“2”中没有两条记录时,我需要不匹配的记录< / p>
SELECT SMPHQ_Active_Item.SMPHT_Mod.ItemID, SMPHT_LKP_ProOpt.*, SMPHT_Med.*
FROM (SMPHQ_Active_Item
INNER JOIN SMPHT_LKP_ProOpt ON SMPHQ_Active_Item.Comp = SMPHT_LKP_ProOpt.Comp)
LEFT JOIN SMPHT_Med ON
(
((SMPHT_LKP_ProOpt.State = SMPHT_Med.StateCode) OR ((SMPHT_LKP_ProOpt.State = 'A1') AND ((SMPHT_Med.StateCode ='1' AND SMPHT_Med.StateCode = '3'))))
AND (SMPHT_LKP_ProOpt.OptCode = SMPHT_Med.OptCode)
)
干杯