I have a weird feeling that this post might be related to what you are trying to accomplish: http://teknoid.wordpress.com/2008/08/06/habtm-and-join-trickery-with-cakephp/
Well, hopefully it does help somehow ;) On Dec 22, 11:21 am, dev <minde...@gmail.com> wrote: > i'm building custom SQl query and need a little help. > > query: > select distinct adverts.id, adverts.code from adverts left join images > on (images.advert_id = adverts.id) left join options on > (options.advert_id = adverts.id) where (SELECT count(1) FROM images > WHERE adverts.id = images.advert_id) > 0 AND options.option IN (3, 4); > > but i want to get all Advert records, where options.option has all > these values (3,4). When i'm using IN(), these values are with OR > operator, how to set AND? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---