Example mysql
SELECT * FROM listings WHERE (
1 IN (SELECT id FROM listings_x WHERE listings_x.type = listings.type) AND
2 IN (SELECT id FROM listings_x WHERE listings_x.type = listings.type) AND
3 IN (SELECT id FROM listings_x WHERE listings_x.type = listings.type) AND
)
Is there a better way than doing the same select statement multiple times. I havent been able to figure this one out, and I dont really like this method as it doesnt seem all that efficient.