lundi 28 septembre 2015

laravel 5 subquery eloquent

How to write a request for such a plan

    SELECT T1.id, T1.name_ua,
    (SELECT COUNT(*) FROM categories T2 WHERE T2.parent_id = T1.id)  AS children_count
  FROM categories T1 WHERE parent_id = 0



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1h3zF0e
via IFTTT

Aucun commentaire:

Enregistrer un commentaire