Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aamir616pk's avatar

How to find number of tasks in every project in Query Builder.

Hello Everyone,

Let me explain the scenario, I've two SQL tables, 1st is Projects Table and 2nd is Tasks table. Projects table contains 3 projects e.g ['Project1' , 'Project2' , 'Project3'] and every project has different Number of tasks in Tasks Table by using Project_id. E.g Project1 have 3 tasks Project2 have 5 tasks Project3 have 7 tasks.

Now I want to get fetch all Projects record in array along with their tasks list, Like ​`` Array [ 0:Project1 [ 0:Task1[....] 1:Task2[...] ] 1:Project2[ 0:Task1[....] 1:Task2[...] 2:Task3[...] ] 2:Project3[ 0:Task1[....] 1:Task2[...] 2:Task3[...] 3:Task4[...] ] ] ?lease help in this case, I'm very thankful . Best Regards

0 likes
1 reply

Please or to participate in this conversation.