jeudi 18 novembre 2021

How can I convert RAW query into Laravel Eloquent way

I have this raw query, But I am not able to convert into Laravel Eloquent

Plain Raw Query:

 select * from 
     (select ci.list_id, count(ci.id) as invalid_items_count from dgo_curated_list_items ci, 
      dgo_video_post_ext v, dgo_shows s
      where ci.object_id = v.ID and v.`show_id` = s.id
      and type = 'video'
      and (v.post_status = 'draft' 
      or v.`license_from_date` > now() 
      or v.`license_to_date` < now()
      or s.`status` = 0)
      group by ci.list_id) a,
   (select i.list_id, count(i.id) as origin_items_count from 
       dgo_curated_list_items i 
       group by i.list_id) b where a.list_id = b.list_id and invalid_items_count = origin_items_count;


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3DxZPDG
via IFTTT

Aucun commentaire:

Enregistrer un commentaire