combining records

G

Guest

I have a database that contains 4 tables: PO_Hdr, PO_Notes, PO_Detail,
Tag_nbr. I have created a query (Tag_info) that brings together the
information I need for a label printing program. The problem I have is that
the query has several lines of data for one tag number. I need the query to
print one line per tag and all of the product descriptions and quantities on
the same line.

Tag_No PO_Nbr Ship_to_nbr Prod_Desc Qty
12345 9985 001 product 1 15
12345 9985 001 product 2 25
12345 9985 001 product 3 5
12345 9985 001 product 4 25
12346 9985 001 product 2 45
12346 9985 001 product 3 8

I need it to look like:

Tag_No PO_Nbr Ship_to_nbr Prod_Desc Qty Prod_Desc Qty
12345 9985 001 product 1 15 product 2
25 product 3 5 product 4 25
12346 9985 001 product 2 45 product 3 8

Any help would be appreciated.
 
G

Guest

Try this --
TRANSFORM First([Prod_Desc] & " " & [Qty]) AS Expr2
SELECT [klnmis-1].Tag_No, [klnmis-1].PO_Nbr, [klnmis-1].Ship_to_nbr
FROM [klnmis-1]
GROUP BY [klnmis-1].Tag_No, [klnmis-1].PO_Nbr, [klnmis-1].Ship_to_nbr
PIVOT Val(Right([Prod_Desc],2));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top