Monday, March 6, 2017

mysql select all from table but change column name of only one

I need to select a table which contains id, name and some more. Now i want to select everything, but just change the column name 'name' to 'user_name'. How can i do this without selecting and declaring everything? I tried it like this, but this is not working.

return $query
->select(
  'user.*',
  'user.name as user_name'
)



via hatemjapo

Advertisement