rearanging data from rows to columns

G

Guest

I am importing a table from another db that has fields of "date updated"
"area" "section" "products" "quantity"
For each date all areas are repeated, there are multiple sections in an
area, there are 4 products (A,B,C,D) and quanities for each.

What I need is to create a query that:

1. only pulls the newest date

2. only pulls 1 area (I did that by putting the name in criteria)

3. (the hard part) change the field from products to A, B, C, & D and move
the quantities under the appropiate field for each section

This query will be copied 5 times using 1 of 6 different areas
 
M

Michel Walsh

Hi,


To get the latest row for each "item", see
http://www.mvps.org/access/queries/qry0020.htm.

If you wish only the items of the latest date stamp (only those with a
mention of that date stamp), use


... WHERE dateStamp = (SELECT MAX(dateStamp) FROM myTable)


Save the query and use a crosstab on the saved query in step 2 to get the
result of step 3.


Hoping it may help,
Vanderghast, Access MVP
 

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