> On 23 Jan 2020, at 08:34, selva kumar <selva.logic@hotmail.com> wrote:
>
> Greetings,
>
> We tried query in a following manner.
>
> SELECT * FROM A where A.id IN (SELECT B.id from B);
>
> In the above query Table B does not have id. But this query return all A table records
>
> Note : If we run inner query alone, It throws error like “Field is not found”
This is not reproducible for me, it fails as expected:
db=# select * from a where a.id in (select b.id from b);
ERROR: column b.id does not exist
LINE 1: select * from a where a.id in (select b.id from b);
^
HINT: Perhaps you meant to reference the column "a.id".
Which version of postgres are you using, and how are you executing the query?
cheers ./daniel