Converting column data into rows - reverse transpose

G

Guest

Hi, I need some help converting data as follows in an MS .
Access database.

Table Name: Table_Payments

Currenlty the data looks as follows:
Account 1st_Payment 2nd_Payment 3rd_Payment
123 1/1/2007 2/1/2007 3/1/2007
222 12/1/2006 1/1/2007 2/1/2007


I'd like it to look like this:
Account Payment_Date Payment_Number
123 1/1/2007 1st_Payment
123 2/1/2007 2nd_Payment
123 3/1/2007 3rd_Payment
222 12/1/2006 1st_Payment
222 1/1/2007 2nd_Payment
222 2/1/2007 3rd_Payment

I'd appreciate any help.
Thank you.
 
G

Guest

You can use a union query like:
SELECT Account, 1st_Payment as Payment_Date, "1st_Payment" as Payment_Number
FROM tblUnNormalized
UNION ALL
SELECT Account, 2nd_Payment, "2nd_Payment"
FROM tblUnNormalized
UNION ALL
SELECT Account, 3rd_Payment, "3rd_Payment"
FROM tblUnNormalized;
 

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