Let's say I have the following SQL query:
SELECT Meeting.id AS meetingId, Bill.id AS billId
FROM Meeting
LEFT JOIN Bill ON Meeting.FK_BillId = Bill.id
That outputs the following:
meetingId | billId
------------------
a | NULL
b | NULL
c | 1
d | 1
e | 1
f | 2
g | 2
And I would like the following output, that groups by billId's that aren't NULL:
meetingId | billId
------------------
a | NULL
b | NULL
c | 1
f | 2
How can I achieve that? By the way, I am not concerned by the ambiguous meetingId of the grouped results.
Thanks for your help!