Ad

How To Make Tree Joins At The Same Time With Laravel Query Builder?

- 1 answer

I tried to make tree joins with this code, but didn't work...

$av = DB::table('rifcliente_filtro')
    ->join('clientes_incid', 'rifcliente_filtro.rif', '=', 'clientes_incid.rif', '=', 'incidencias.rif')
    ->where('clientes_incid.cat_cliente', 'AV')
    ->count();

Can somebody help me?

Ad

Answer

Do like this

$av = DB::table('rifcliente_filtro')
->join('clientes_incid', 'rifcliente_filtro.rif', 'clientes_incid.rif')
->join('incidencias','incidencias.rif','rifcliente_filtro.rif')
->where('clientes_incid.cat_cliente', 'AV')
->count();

Please refer Laravel docs

Ad
source: stackoverflow.com
Ad