Transpose horizontal fields into one field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please help

I need to transpose (like in excel) 4 horizontal fields in the same record
into one field through a select query by id (autonumber )

The query result will the be 1 column and 4 rows all with the same primary key number

Is it possible ?
 
Dear Laynne:

Looking at your two posts, I think what you need is a UNION query like
this:

SELECT ID, "P1" AS Source, Parent1 AS Value FROM YourTable
UNION ALL
SELECT ID, "P2" AS Source, Parent2 AS Value FROM YourTable
UNION ALL
SELECT ID, "C1" AS Source, Child1 AS Value FROM YourTable
UNION ALL
SELECT ID, "C2" AS Source, Child2 AS Value FROM YourTable

I have added a column named Source which you did not ask for. It can
be used to keep track of the column in the original table from which
the value originated. You can ignore it, or you can remove it from
the above. However, to do so would result is a "reduction in the
amount of information available." I tend to try to preserve
information when possible.

The above query, as with all UNION queries, cannot be created or
viewed in the design grid. It must be pasted into the SQL view of a
new query, then saved and run.

I hope this is the type of solution you require.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Back
Top