Adding multiple records

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Adding multiple records

Post by DavJans » 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
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Re: Adding multiple records

Post by DavJans » Fri Jan 31, 2014 12:21 am

the forum omits multiple spaces in a row, I hope the table I tried to show is understandable.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Re: Adding multiple records

Post by DavJans » Fri Jan 31, 2014 12:53 am

Code: Select all

SELECT employee, SUM(weldqt) FROM cjp GROUP BY employee
I got this to work thank you :)
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Adding multiple records

Post by Simon » Sat Feb 01, 2014 3:02 am

Hi DavJans,
Really like this "Real World" application of liveCode :)

I don't think that an example of a liveCode product needs to be a killer app, would you consider writing a paragraph and posting a pic of it here:
http://livecode1001.blogspot.com/

Even if you are using drag n' drop controls and it doesn't look pretty it still is a meaningful application.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply