PIVOT table query ?

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
Back
Top