Struggling with the terminology here...
I have a table of elements which may or may not be present in a group:
elem | grp
----------
1 | A
1 | B
2 | A
3 | C
I'd like to turn this into a table showing true/false for each permutation:
elem | A | B | C
----------------------------
1 | true | true | false
2 | true | false | false
3 | false | false | true
There's an arbitrary number of elements and groups - I can't hardcode a list of groups into the query.
What is the name of what I'm trying to do here? And is there a canonical solution (which can be implemented within a single SELECT
statement - subqueries and CTEs are fine - in Postgres9.6 to drive a SAP BusinessObjects report)?