jeudi 8 octobre 2020

change the postgres query to laravel query

I have the postgres query which I want to convert it into laravel query

Postgres query

select string_agg(col, ', ' order by col) 
        from jsonb_each_text(to_jsonb(geo_access) - 'id') t(col, val)
        where t.val = '1') as geos from geo_access

I have tries in laravel as

DB::table ('geo_access')->raw("select string_agg(col, ', ' order by col) 
        from jsonb_each_text(to_jsonb(geo_access) - 'id') t(col, val)
        where t.val = '1' as geos" )->get();

I have caught the error as Call to undefined method Illuminate\Database\Query\Expression::where()



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire