Here is my query:
SELECT rid
FROM relations
WHERE rootid IN (736, 781)
GROUP BY rid HAVING COUNT(rid) = 2");
I'm trying to implement that in Laravel. How can I do that? (both "query builder and eloquent approaches are fine to me")
This doesn't work: (it throws "something went wrong")
DB::table('relations')
->select('')
->whereRaw('rootid IN (736, 781)')
->groupBy('rid')
->havingRaw('COUNT(rid) = 2')
->get();
via stack