How to handle a null id nicely

This is a pretty tricky query, I think there may be some ninja HTML feature inside data explorer, so you would basically use something like:

case when group_id IS NOT NULL
   then 'http://abc/groups/` || group_id::text
   else 'http://abc/user/` || user_id::text
end

And then construct a link from that. If you want to just show the name of the group / user in one column without it being a hyperlink it is a bit easier.

What is the SQL you have now?