Comparing 2 tables MySQL
Posted: Tue Sep 01, 2015 3:48 pm
Hi and thank you all in advance, I'm struggling to find the best way and how to compare 2 tables for the result I want.
We have 1 table(QC) which gets filled out by our quality control department, we also have another table(PN) that we add a list production notes to.
Only two columns in both tables match, JobNumber and PieceMark.
What I'm trying to do is compare the two and in a third table(Open PN's) we want add the pieces where the Production note is not done.
In fact there are actually 3 tables already(third one is pn's already linked to the piece, APN(Attached PN's), How would I populate the 4th?
Table QC
ID, Job, Piecemark
1, 6216, A53
Table APN
ID, PNn, Done
1, 1, Done
1, 2, Done
1, 3,
(PNn 4 hasn't been populated in this table yet, at this time in my program this gets populated when someone looks at the record in Table QC Not when it is added to the Table PN)
Table PN
Job, Piecemark, PNn
6216, A53, 1
6216, A53, 2
6216, A53, 3
6216, A53, 4
Those are the tables we have now, What I need is to populate a table or just a list? with only the open pn's
Table OPN
ID, Job, Piecemark, PNn
1, 6216, A53, 3
1, 6216, A53, 4
We have 1 table(QC) which gets filled out by our quality control department, we also have another table(PN) that we add a list production notes to.
Only two columns in both tables match, JobNumber and PieceMark.
What I'm trying to do is compare the two and in a third table(Open PN's) we want add the pieces where the Production note is not done.
In fact there are actually 3 tables already(third one is pn's already linked to the piece, APN(Attached PN's), How would I populate the 4th?
Table QC
ID, Job, Piecemark
1, 6216, A53
Table APN
ID, PNn, Done
1, 1, Done
1, 2, Done
1, 3,
(PNn 4 hasn't been populated in this table yet, at this time in my program this gets populated when someone looks at the record in Table QC Not when it is added to the Table PN)
Table PN
Job, Piecemark, PNn
6216, A53, 1
6216, A53, 2
6216, A53, 3
6216, A53, 4
Those are the tables we have now, What I need is to populate a table or just a list? with only the open pn's
Table OPN
ID, Job, Piecemark, PNn
1, 6216, A53, 3
1, 6216, A53, 4