SELECT ...... where u.id in ( SELECT userid FROM (select `entityId` as userid from table_a union select userid from table_b) g
This gives me an error! Column ‘userid’ in field list is ambiguous
I can’t seem to understand which column to use when employing union!
Will the bottom table get merged into the top one and I need to use the top table’s column as reference?
If I use
SELECT * gives me an error about the fact that there can only be one column!
Please take a look at my query.
P.S. Should I use SELECT userid or SELECT entityId