Thanks Igor, that seems to work. It's extremely slow with my real data though. I'll have to look into that. Also, to actually filter the products, I would have to add additional joins outside that sub-select correct?
On Wed, Nov 10, 2010 at 4:26 PM, Igor Tandetnik <itandet...@mvps.org> wrote: > James <ja...@icionline.ca> wrote: >> This will only display products which have items with images. > > True. Make it > > select name, filename from products p left join images im on im.item_id = ( > select im2.item_id from items left join images im2 on (items.id = > im2.item_id) > where items.product_id = p.id and items.buyable > order by position desc limit 1) > order by name; > > Igor Tandetnik > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users