PIVOT table query ?

G

Guest

I have a two column table, the first column is a name and the second column a
value.
I need a PIVOT table query that gives me one row with column headings from
the first column and values for each column from the value column. E.g.
Name Value
ID 1
Type ABC
Qty 3
I need to convert to single row:
ID Type Qty
1 ABC 3

I tried using the Crosstab wizard and changing the query in varuious ways
but have not been able to achieve this. The closest I came is getting each
value in the correct column but in a separate row.

Thanks.
 
D

Dale Fye

Try the following:

TRANSFORM First(tbl_Pivot_Test.FieldValue) AS FirstOfFieldValue
SELECT 1 AS Expr1
FROM tbl_Pivot_Test
GROUP BY 1
PIVOT tbl_Pivot_Test.FieldName;

Note that I have changed the names of your fields as Name and Value are both
reserved words in Access. All I did was add a constant(1) as the RowHeader,
made the FieldName column the column header, and selected First in the Total
row of the FieldValue column.

HTH
Dale
 

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