>> On 03/13/2016 10:07 PM, Tom Smith wrote: >>> It would help if the resultset has some param to mark which is which >>> with the grouping sets index. I think you're looking for the GROUPING() function. See http://www.postgresql.org/docs/9.5/static/functions-aggregate.html regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general