tags:

views:

37

answers:

1

I have the following table:

Source Plate1   Plate2   Plate3   Plate4

which I want to transform to this table:

Source Plate1
Source plate2
source Plate3
source Plate4

so basically appending all the data from the 4 Plate fields into 1 column

How do I do this in ms acces?

thanks

+2  A: 

You can use a Union query, for example:

INSERT INTO NewTable (Source, Plate)
SELECT Source, Plate FROM
  (SELECT Source, Plate1 As Plate FROM Table
   UNION ALL 
   SELECT Source, Plate2 As Plate FROM Table
   UNION ALL 
   SELECT Source, Plate3 As Plate FROM Table
   UNION ALL 
   SELECT Source, Plate4 As Plate FROM Table) As t

EDIT: the Union part by itself:

   SELECT Source, Plate1 As Plate FROM Table
   UNION ALL 
   SELECT Source, Plate2 As Plate FROM Table
   UNION ALL 
   SELECT Source, Plate3 As Plate FROM Table
   UNION ALL 
   SELECT Source, Plate4 As Plate FROM Table

Or

 SELECT Source, Plate FROM 
  (SELECT Source, Plate1 As Plate FROM Table
   UNION ALL 
   SELECT Source, Plate2 As Plate FROM Table
   UNION ALL 
   SELECT Source, Plate3 As Plate FROM Table
   UNION ALL 
   SELECT Source, Plate4 As Plate FROM Table) As s
Remou
that worked beautifully. However, instead of creating a new table, can I get the results of the Union query in the query itself? I would like to use that query as part of a bigger one and the source table is still active with daily new entries.
paul
Sure, I have added to my post, please note that a union query is not updatable.
Remou
Thank you very much, I think I am all set,
paul