I have this query which is generated by application. It is not throwing any errors. I am wondering how the group by clause can work without having any aggregate functions in there. Can someone please exlpain.
SELECT customer.id AS customer_id,
customer.firstname AS customer_firstname,
customer.lastname AS customer_lastname,
customer.skype_id AS customer_skype_id,
customer.phone AS customer_phone,
customer.punch_line AS customer_punch_line,
FROM customer
JOIN accounts ON accounts.id = customer.id
LEFT OUTER JOIN customer_skills ON customer.id = customer_skills.customer_id
LEFT OUTER JOIN skills ON skills.id = customer_skills.skill_id
WHERE accounts.activated_at IS NOT NULL
AND accounts.published_at IS NOT NULL
AND (EXISTS
(SELECT 1
FROM customer_skills
WHERE customer.id = customer_skills.customer_id
AND skills.title IN (:title_1,
:title_2)))
GROUP BY customer.id,
accounts.id
ORDER BY accounts.registered_at DESC