I have table Company
+--------------------------+
| id | companyname |
+--------------------------+
| 1 | JACK |
| 2 | ANDY |
and table Job
+--------------------------------+
| id | id_com | title job |
+--------------------------------+
| 1 | 1 | php |
| 2 | 1 | mysql |
| 3 | 1 | html |
| 4 | 2 | css |
and I want my result like this :
id | company name | Number of job |
+----------------------------------+
1 | JACK | 3 |
2 | ANDY | 1 |
Job belong to company Company has many job How can I do this with Mysql or Query Builder Laravel
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire