开发者

Need help with zend_select() Join

I'm currently working with Zend framework and I need help to convert this query to zend_select() format. Can someone kindly help me out please

Thanks so much in advance!

SELECT p .* 
FROM provider p
INNER JOIN providerReligionPreference prp ON p.providerId = prp.providerid
INNER JOIN providerServicePreference psp ON p.providerId = psp.providerId
INNER JOIN areaProviderPreference ap开发者_Go百科 ON p.providerID = ap.providerId
INNER JOIN quote q ON q.quoteTypeId = prp.quoteTypeId
AND q.quoteTypeId = psp.quoteTypeId
AND q.religionTypeId = prp.religionTypeId
AND q.serviceTypeId = psp.serviceTypeId
AND q.postcodeId = q.postcodeId
WHERE q.quoteId = 2

GROUP BY p.providerId


In a model method you could smth along these lines :

$select = $this->select();
$select->from('provider',array('*'))
        ->joinInner('providerReligionPreference', 'provider.providerId = providerReligionPreference.providerid')
        ->joinInner...
        ...
        ->joinInner('quote', 'quote.quoteTypeId = providerReligionPreference.quoteTypeId AND ...')
        ->where('quote.quoteId = ?', 2)
        ->group('provider.providerId')
        ;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜