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



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire