Normalize Help

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I was give an excel spread sheet of data that I want to normalize in Access.
I placed it in a table, but want to change the data layout as follows.

Current Data

ITEM JAN 07 FEB 07 MAR 07 ...etc
Widget1 500 300 450
Widget2 200 220 200
etc

Would Like to Change it to the following

ITEM DATE QTY_SOLD
Widget1 Jan 07 500
Widget1 Feb 07 300
Widget1 Mar 07 450
etc

I am assuming I could do it with an Union Query and then a make table, but
not sure how to write the SQL.

If anyone could help that would be great..
Thanks
 
K

Ken Snell [MVP]

An example of the union query that you'd need to build:

SELECT ITEM, "Jan 07" AS [DATE], [JAN 07] AS [QTY_SOLD]
FROM YourTableName
UNION ALL
SELECT ITEM, "Feb 07" AS [DATE], [FEB 07] AS [QTY_SOLD]
FROM YourTableName
UNION ALL
SELECT ITEM, "Mar 07" AS [DATE], [MAR 07] AS [QTY_SOLD]
FROM YourTableName
UNION ALL
etc etc
SELECT ITEM, "Dec 07" AS [DATE], [DEC 07] AS [QTY_SOLD]
FROM YourTableName;


Then use the union query as the "table" for the append query.
 

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