Convert From Column to Row (Record)

  • Follow


I have a table:

ID     Price     Quantitiy
1      1.00       2

I would like to create a make table query to convert the original
table to something like this:

ID     Measure     Data
1      Price          1.00
1      Quantity      2

Please help, hopefully ther is a simple solution!!!

0
Reply banker123 1/23/2008 6:04:28 PM

Look up Excel Paste Special - Transpose for a solution.

Or try this ---
SELECT "Price" AS Measure, [URTable].[Price] AS Data
FROM URTable
UNION ALL SELECT "Quantity" AS Measure, [URTable].[Quantity] AS Data
FROM URTable;

-- 
KARL DEWEY
Build a little - Test a little


"banker123" wrote:

> I have a table:
> 
> ID     Price     Quantitiy
> 1      1.00       2
> 
> I would like to create a make table query to convert the original
> table to something like this:
> 
> ID     Measure     Data
> 1      Price          1.00
> 1      Quantity      2
> 
> Please help, hopefully ther is a simple solution!!!
> 
> 
0
Reply Utf 1/23/2008 7:31:04 PM


The SQL did not return the ID field, but did seem like step in the
right direction, please advise??

results of SQL:
Measure     Data
Price          1.00
Quantity      2

desired results
ID     Measure     Data
1      Price          1.00
1      Quantity      2
0
Reply banker123 1/23/2008 7:59:41 PM

Add the ID field into the UNION query
SELECT ID, "Price" AS Measure, [URTable].[Price] AS Data
FROM URTable
UNION ALL
SELECT ID, "Quantity" AS Measure, [URTable].[Quantity] AS Data
FROM URTable;

-- 
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"banker123" <bradbrockman@yahoo.com> wrote in message 
news:2e6b9531-eb39-48b9-aca7-235169db8d67@d4g2000prg.googlegroups.com...
> The SQL did not return the ID field, but did seem like step in the
> right direction, please advise??
>
> results of SQL:
> Measure     Data
> Price          1.00
> Quantity      2
>
> desired results
> ID     Measure     Data
> 1      Price          1.00
> 1      Quantity      2 


1
Reply John 1/23/2008 8:07:48 PM

Awesome, thank you!!
1
Reply banker123 1/23/2008 8:27:02 PM

Thanks worked great!
0
Reply banker123 1/23/2008 9:42:58 PM

How do I make this a make table action query?
0
Reply banker123 1/24/2008 3:42:10 PM

Save the query.

Then use the saved query as the source of a make table query.

--A NEWquery in Design view
--Select the saved query as the source
--Select the fields you want
--SELECT Query: Make Table Query from the menu



-- 
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"banker123" <bradbrockman@yahoo.com> wrote in message 
news:92807432-4852-4322-9212-58d6636a6bf2@e23g2000prf.googlegroups.com...
> How do I make this a make table action query? 


0
Reply John 1/24/2008 5:14:12 PM

7 Replies
658 Views

(page loaded in 0.193 seconds)

Similiar Articles:
















7/19/2012 4:48:20 PM


Reply: