MySQL 8 has ANY_VALUE() [1] to do just this. Also your example does not work any longer unless that now-deprecated behavior is explicitly enabled.
select a, any_value(b), any_value(b) from table group by a
https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functi...