我想在 zend 框架 2 中编写如下的 mySQL 查询。
如何在 zend Db 选择约定中转换它?
SELECT profiles.*,
user.email,
user.first_name,
user.last_name,
portfilio_images.profileImage,
images.url AS imgurl
FROM profiles
INNER JOIN user ON user.user_id = profiles.ownerId
LEFT JOIN (
SELECT *
FROM portfilio_images
WHERE portfilio_images.profileImage = '1'
) as portfilio_images ON portfilio_images.profileId = profiles.id
LEFT JOIN images ON images.id = portfilio_images.imageId
WHERE profiles.ownerId != '4' AND (profiles.name LIKE '%a%' OR user.first_name LIKE '%a%' OR user.last_name LIKE '%a%')
GROUP BY user.user_id