Suppose I have two tables Table1 and Table2 with the following data.
Column1 Column2 Column3
AAA KKK 9
BBB LLL 7
CCC MMM 9
DDD MMM 5
EEE MMM 7
FFF NNN 9
GGG OOO 1
Column4 Column1
TTT DDD
TTT BBB
UUU EEE
VVV BBB
WWW AAA
WWW BBB
XXX DDD
YYY EEE
YYY DDD
YYY CCC
YYY FFF
The query is of selecting "select value(s) from column4 which matches the tuple result of column1 when column2 has the value 'MMM'('CCC','DDD','EEE') this result should match with all results from column4" the result is 'YYY'
The error message is
SELECT DISTINCT t2.Column4
FROM Table1 t1
LEFT JOIN Table2 t2 ON t1.Column1 = t2.Column1
WHERE Column2 = 'MMM'
GROUP BY t1.Column2
HAVING COUNT(t1.Column1) = COUNT(t2.Column1)
*
ERROR at line 1:
ORA-00904: "T1"."Column1": invalid identifier