Combining data from multiple sources in one column
It seems you want a UNION:

SELECT id AS aid,  cid,  somedata 
FROM a

UNION -- ALL

SELECT a.id,  c.id,  a.somedata
FROM a JOIN c ON a.bid = c.bid ;


It's not clear if you want a UNION DISTINCT or UNION ALL. If it's the first, you could combine the subqueries into one, using OR. That may produce different plan though, which may be less efficient:

SELECT a.id AS aid,  c.id AS cid,  a.somedata
FROM a JOIN c ON a.bid = c.bid 
              OR a.cid = c.id ;