sql - Undefined Column | Laravel Eloquent Reverse Like -
i want rows have column part of string (not inverse)
i did query,
select * table 'string' concat('%', column, '%')
the query works correctly when running directly on server via sql querying tool.
however, i'm using eloquent orm, tried following :
$results = model::where('my_string','like',"concat('%',column, '%')")->get();
it throws error :
sqlstate[42703]: undefined column: 7 error: column "my_string" not exist
line 1:
please note i'm not looking :
select * table column '%string%'
from comment above. if got working sql statement. can use raw expressions
model::whereraw("'string' concat('%', column, '%')");
for more information, http://laravel.com/docs/5.0/queries in raw expressions
section
Comments
Post a Comment