Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y
От | Thorsten Glaser |
---|---|
Тема | Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y |
Дата | |
Msg-id | 9e86b053-a29a-a82-78f0-1228a391edc3@evolvis.org обсуждение исходный текст |
Ответ на | Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y (Alban Hertroys <haramrae@gmail.com>) |
Ответы |
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y
|
Список | pgsql-general |
On Fri, 3 Mar 2023, Alban Hertroys wrote: >You can rewrite that into something like this: > >select jsonb_build_object('opening_times’, > obj > ORDER BY > obj->>'weekday’, > obj->>'from_hour’, > obj->>'to_hour') >) >from cot >cross join lateral jsonb_agg(jsonb_build_object( > 'weekday', cot.weekday, > 'from_hour', cot.from_hour, > 'to_hour', cot.to_hour) obj But isn’t that the same as with a regular LEFT JOIN? >> cgwaj AS ( >> SELECT cgwa.id AS id, jsonb_build_object( >> 'weekday', cgwa.weekday, >> 'forenoon', cgwa.forenoon, >> 'afternoon', cgwa.afternoon, >> 'evening', cgwa.evening) AS obj >> FROM core_generalworkavailability cgwa plus >> LEFT JOIN cgwaj ON cgwaj.id=cppwt.generalworkavailability_id With the addition that I can aggregate… bye, //mirabilos -- 15:41⎜<Lo-lan-do:#fusionforge> Somebody write a testsuite for helloworld :-)
В списке pgsql-general по дате отправления: