Table 1:
Name Address Height Weight
X. y z. p
G. H. I J
Q W. E. R
Table 2:
Name Income Tax
X. y z
A B C
Trying compare the rows between the two tables and get the names that appear only in table 1 and not in table 2 as well? However, I am only trying to compare only certain rows from table_1, for example – the rows which contain Height= I and E do not need to be on the count.
Here is what I have so far but I am getting a syntax error:
SELECT count(DISTINCT "Name") FROM table_1 WHERE table_1.Height LIKE ANY CONCAT('%', {'I', 'E'} '%')
WHERE NOT EXISTS (
SELECT DISTINCT UPPER("Name") FROM table_2 WHERE table_2."Income" = 'y' AND UPPER(table_2."Name") LIKE CONCAT('%', UPPER(table_1."Name"), '%')
)