आपको प्रत्येक लागत के लिए एक नई लागत तालिका चाहिए:
Projects
-----------------
Project_id
Name
Users
--------------------
User_id
Username
Costs
----------------
Cost_id
Amount
Project_id
User_id
..
प्रति उपयोगकर्ता प्रति परियोजना परियोजना लागत खोजने के लिए:
Select sum(c.Amount) as total_cost, count(*) as num_costs, p.Project_id,p.Name as project_name, u.user_id, u.Username
From costs c inner join project p on c.Project_id=c.Project_id
Inner join users u
On c.User_id=u.User_id
Group by p.Project_Id, u.user_id
प्रति उपयोगकर्ता लागत के लिए
Select sum(c.Amount) as total_cost, count(*) as num_costs, u.user_id, u.Username
From costs c
Inner join users u
On c.User_id=u.User_id
Group by u.user_id