For MS Access SQL, want to use EXCEPT in Access for three columns in table1 to 1 column in table 2 -
i have 3 columns in table a. trying design query call out values (in 3 columns) not apepar in 1 column have in table b. if helps make more clear, table b list of currencies in iso codes , table 3 columns of currencies being used, identifying values not using iso codes denote currency.
currently, can't seem them match 1 column, made 2 more columns in table b can match them individually. constraints are, cannot change table , must in 1 query. got far below.
select m.currency1, i.iso_code, m.currency2 , i.iso_code1, m.currency3, i.iso_code2 m left join b on m.currency=i.iso_code , m.currency2=i.iso_code1 , m.currency3=i.iso_code2 i.iso_code null or i.iso_code1 null or i.iso_code2 null;
i wouldn't bother making multiple columns in 'b'. played in sqlfiddle , got work.
something this:
select
m.currency1, i.iso_code,
m.currency2, j.iso_code iso_code1,
m.currency3, k.iso_code iso_code2
from m
left join b i
on m.currency1 = i.iso_code
left join b j
on m.currency2 = j.iso_code
left join b k
on m.currency3 = k.iso_code
where
i.iso_code null or
j.iso_code null or
k.iso_code null
Comments
Post a Comment