L
lschultz
I have a similar problem to the discussion string below.
My MS Access table is from an XLS and is in the following format:
Field1 Field2 Field3 Field4
-------- --------- ---------- ----------
<blank> Jan-06 Feb-06 Mar-06
cust1 100 200 300
cust2 400 500 600
cust3 700 800 900
and i need to get it into the following format.
Field1 Field2 Field3
--------- -------- ---------
cust1 Jan-06 100
cust1 Feb-06 200
cust1 Mar-06 300
cust2 Jan-06 400
cust2 Feb-06 500
cust2 Mar-06 600
cust3 Jan-06 700
cust3 Feb-06 800
cust3 Mar-06 900
The "normalizing union query" in the discussion below was effective in
getting Field1 and Field3 merged. However, I need the Field2 "date"
also. Any suggestions would be appreciated.
------------------------------------------------------------------------------------------------------
Thank you John and Duane for your help. I tried on about a dozen
fields on the table and it seem to work. Next I have to convert the
table consists of 150+ columns with missed type (text, number). The
SQL statement will be quite large and hope that it'll run ok and there
is no limit to it.
----- John Vinson wrote: -----
item selected. Is there a query that I can convert the columns into
rows? for example:
A "Normalizing Union Query" would do the trick here. You'll need
to go
to the SQL window but it's not hard:
SELECT UserID, "ItemA" As ItemSelected FROM table WHERE [ItemA] =
1
UNION
SELECT UserID, "ItemB" As ItemSelected FROM table WHERE [ItemB] =
1
UNION
SELECT UserID, "ItemC" As ItemSelected FROM table WHERE [ItemC] =
1
UNION
SELECT UserID, "ItemD" As ItemSelected FROM table WHERE [ItemD] =
1
....
Create this Query and check that it returns the desired data;
then
save it (say as uniAllSelected) and base an Append or MakeTable
query
on the saved query.
John W. Vinson[MVP]
My MS Access table is from an XLS and is in the following format:
Field1 Field2 Field3 Field4
-------- --------- ---------- ----------
<blank> Jan-06 Feb-06 Mar-06
cust1 100 200 300
cust2 400 500 600
cust3 700 800 900
and i need to get it into the following format.
Field1 Field2 Field3
--------- -------- ---------
cust1 Jan-06 100
cust1 Feb-06 200
cust1 Mar-06 300
cust2 Jan-06 400
cust2 Feb-06 500
cust2 Mar-06 600
cust3 Jan-06 700
cust3 Feb-06 800
cust3 Mar-06 900
The "normalizing union query" in the discussion below was effective in
getting Field1 and Field3 merged. However, I need the Field2 "date"
also. Any suggestions would be appreciated.
------------------------------------------------------------------------------------------------------
Thank you John and Duane for your help. I tried on about a dozen
fields on the table and it seem to work. Next I have to convert the
table consists of 150+ columns with missed type (text, number). The
SQL statement will be quite large and hope that it'll run ok and there
is no limit to it.
----- John Vinson wrote: -----
ItemC, ItemD, etc and each item stores a "1" or a "0" depending on theI have a table with the columns as: UserId, ItemA, ItemB,
item selected. Is there a query that I can convert the columns into
rows? for example:
001 1 1 0 0
001 ItemA
001 ItemB
A "Normalizing Union Query" would do the trick here. You'll need
to go
to the SQL window but it's not hard:
SELECT UserID, "ItemA" As ItemSelected FROM table WHERE [ItemA] =
1
UNION
SELECT UserID, "ItemB" As ItemSelected FROM table WHERE [ItemB] =
1
UNION
SELECT UserID, "ItemC" As ItemSelected FROM table WHERE [ItemC] =
1
UNION
SELECT UserID, "ItemD" As ItemSelected FROM table WHERE [ItemD] =
1
....
Create this Query and check that it returns the desired data;
then
save it (say as uniAllSelected) and base an Append or MakeTable
query
on the saved query.
John W. Vinson[MVP]