How to avoid a cartesian product in a where clause and error message AHD03106