lundi 3 février 2020

Query SQL in queryBuilder

Anyone knows how to do this sql query in query builder?

select i., s.
from usersAPP i cross join
news s left join
newsInteractions si
on si.DNIUser = i.DNI and si.idNews = s.id
where si.DNIUser is null;

I tried this but doesn't work

    $no_vis_no_like= DB::table('news')
        ->crossJoin('usersAPP')
        ->leftJoin('newsInteractions', 'news.id', '=', 'newsInteractions.idNews')
        ->leftJoin('newsInteractions', 'usersAPP.DNI', '=', 'newsInteractions.DNIUser')
        ->count();


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire