how to make query with substr in eloquent (laravel 4)? -
i have query:
select substr(id,1,4) id meteo.a2012 group substr(id,1,4)
i want take first 4 numbers id row, i'm trying in eloquent, how do?
thanks.
you need use raw expressions can use special functions that.
model::select(db::raw('substr(id, 1, 4) id'))->groupby(db::raw('substr(id, 1, 4)'))->get();
where model
eloquent model want run query on.
Comments
Post a Comment