Skip to content Skip to sidebar Skip to footer

Laravel 5 Sqlstate[42s22]: Column Not Found

I am doing some joins and trying to get the data. My query builder is: $datasource = DB::table('vehicles')->join('brands', 'vehicles.brand_id', '=', 'brands.id')->join('secti

Solution 1:

You should use selectRaw() instead of select():

->selectRaw('vehicles.*, vehicles.id AS vid');

Read more about raw expressions: http://laravel.com/docs/5.0/queries#raw-expressions

Post a Comment for "Laravel 5 Sqlstate[42s22]: Column Not Found"