Is it possible to create a database query in which I add a prefix to every single column of a table. Because the tables unfortunately have "too many" columns I would like to avoid assigning an alias to every single column.
Goal:
select table1.*, table2 Will output: table1_id, table_1_name, table2_id, table_2_name, ...
Is this possible?
That is my approach:
$data = DB::connection('mysql_wp')->table('wp_posts as p')
->selectRaw('p.*, m.*')
->join('wpao_metas as m', 'm.post_id', '=', 'p.ID')
->get();
dd($data);
But i didnt work. I got columnnames without prefixe.