I need to select data from two tables. However there are two columns, where if one or both rows read NO, I want to skip it.
Table 1
a--b--c-
1 r l
2 t f
3 d c
Table 2
d--e--f--g-
1 r NO NO
2 r YES NO
3 r YES YES
QUERY:
SELECT
talbe1.a,
table1.b,
table1.c,
table2.d,
table2.e,
table2.f,
table2.g,
FROM table1 INNER JOIN
table2 on table1.b = table2.e
WHERE 'no' NOT IN (SELECT table2.f, table2.g FROM table2)
1 Answer