> However, this query does not give me the result I expected. It appears that
> the database engine first calculates the cartesian product of the tables A
> and B and then evaluates the query. Hence, I get multiple matches for

Yup.. WHERE filters the results of the join.

> Is there any way to do this, other than using UNION??

This is what you want. I think you could come out with what you want in
other ways, but this is by far the most appropriate.


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to