Adding multiple records
Posted: Fri Jan 31, 2014 12:19 am
I was hoping someone could point me in the right direction.
What I have is a MySQL database that looks like this:
ID Employee Welds Fail Repair
1 10 5 0 0
2 53 10 0 0
3 10 0 3 0
4 22 0 0 3
5 53 3 0 0
6 244 0 0 8
my list at this point goes on and on, basically we check the welds that our employees do. How many, then they get inspected and we track how many failed and who repaired how many
what I need at this point is totals per employee and as a whole, I'm sure I can figure out how to add everything together to get total welds, fails and repairs, but what I'm unsure about is how to go about adding just the records where the employee is the same. Can I do this with one sql query that gives me all the data and add from there or should I do a query per employee? how would I do that when I don't want to script a query for every employee.
Thank you in advance
What I have is a MySQL database that looks like this:
ID Employee Welds Fail Repair
1 10 5 0 0
2 53 10 0 0
3 10 0 3 0
4 22 0 0 3
5 53 3 0 0
6 244 0 0 8
my list at this point goes on and on, basically we check the welds that our employees do. How many, then they get inspected and we track how many failed and who repaired how many
what I need at this point is totals per employee and as a whole, I'm sure I can figure out how to add everything together to get total welds, fails and repairs, but what I'm unsure about is how to go about adding just the records where the employee is the same. Can I do this with one sql query that gives me all the data and add from there or should I do a query per employee? how would I do that when I don't want to script a query for every employee.
Thank you in advance