1

I'm trying to find a way convert it to query builder in laravel but I still can't do it!!

SELECT * FROM (
  SELECT thanhvientrong.manguoidung, detai.ngaykt, COUNT(*)
    AS c FROM detai
    INNER JOIN thanhvientrong ON detai.madt = thanhvientrong.madt AND detai.id_cap = 5
    GROUP BY thanhvientrong.manguoidung HAVING c > 0
  )
  AS dem where DATE(ngaykt) BETWEEN '2019-09-14' AND '2020-09-15'
fcdt
  • 2,371
  • 5
  • 14
  • 26

1 Answers1

0

Firstly, I'm not really catch what you mean. But, i think these solutions will help you:

I think relationship will be the best solution for your issue.

Dharman
  • 30,962
  • 25
  • 85
  • 135
quachtinh761
  • 224
  • 1
  • 7