I couldn't think of a better way to ask this question, but here goes:
I have 2 tables. The first is a table of items for label printing jobs. We'll call it pj_items The columns are simply: job_id, part_num and qty
The second table is a list of finishes called PartFinishes on parts with just 2 columns of: PartNumber and FinishId
When I want to retrieve information for the label printer I use:
select pj_items.part_num, pj_items.qty, PartFinishes.FinishId from pj_items
join PartFinishes on PartFinishes.PartNumber = pj_items.part_num
where job_id = 1
This query works fine and gives me the right result when each part has only one finish. The problem is when there are 2 or more finishes on a part.
For example: The part 99401326 has 2 finishes. On my pj_items table I have one row for that part so I can print one label. When I use this query it returns 2 rows for that part each with a different FinishId Unfortunately that would result in 2 labels printed. I need both of those finishes on one row since I only want one label printed with both FinishId's present.
I had a similar query which returned the finishes as new columns (f1,f2,f3) But it would still return 2 rows in the given example with f1 defined in the first row and f1 as null in the second row and f2 being defined in the second.
How can I get that into one row?
Hopefully that makes sense, anyone have any suggestions?
If you need anymore info, let me know.
Thanks!
EDIT:
The pj_items table may have duplicate entries and I need to preserve those as separate rows. I just need to have all the finishes for each part in one row with its respective part.
Example
Here is an example of the pj_items table:

Here is the relevant information from the PartFinishes table:

And here is the result using the original query:

What I need in the result is the two rows of 99401326 are one with both of the finishes in that row, while maintaining the 2 seperate rows for the 99401077 since I want 2 labels of those.