Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT SQL_NO_CACHE
- a.*,
- i.object_id,
- u.phone, u.first_name AS first_name, u.email AS user_email, u.user_type,
- ag.name AS agency_name, ag.phone AS agency_phone, ag.email AS agency_email, ag.url AS agency_site,
- IFNULL(i.object_id, UUID()) AS unq_ancestor,
- GROUP_CONCAT(i.gen_name, '.jpg' SEPARATOR ';') AS image_name
- FROM
- objects a
- LEFT JOIN object_images i ON a.id = i.object_id
- JOIN users u ON u.id = a.user_id
- LEFT JOIN organizations ag ON ag.id = u.organization_id
- WHERE
- a.object_status = 2
- AND a.object_type IN (1, 2, 3, 4)
- GROUP BY a.id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement