Re:Hardly-used SQL Server functions that should be used more...
by cpburns2009 on Thursday April 06, 2017 @12:51PM
(#14052284)
I wasn't aware of that feature. Now I really need to push for upgrading PostgreSQL to a newer version.
> array_remove(array_agg(producer.last_name), NULL) AS last_names
to that
> array_agg(producer.last_name) FILTER(WHERE producer.last_name IS NOT NULL) AS last_names
I wrote about FILTER here: http://modern-sql.com/feature/filter
And how to use ARRAYs rather than concatenated strings here: http://modern-sql.com/feature/listagg#alternative-array