Добрый день!
Имеется таблица компании с json внутри.
Не могу сделать Select с distinct
SELECT p.title, json_agg( distinct cp.title) as cid, json_agg(distinct a) as article, count(*) OVER() as total
FROM products p
JOIN companies cp ON (cp.id = p.cid)
JOIN articles a ON (a.id = p.article)
WHERE p.id = 1
GROUP BY p.title
distinct cp.title - работает
но
distinct cp.* - нет
А мне бы хотелось взять все данные из этой таблицы