How to pivot a ms access table

前端 未结 1 554
小蘑菇
小蘑菇 2021-01-29 11:55

I have the following Data

Table: persons

How can I reproduce the following Results

No there is no ord

1条回答
  •  伪装坚强ぢ
    2021-01-29 12:40

    A CROSSTAB query using DCount can accomplish if there is unique identifier field. Add an autonumber field to the table.

    TRANSFORM First(Persons.Child) AS FirstOfChild
    SELECT Persons.Mother, Persons.Father
    FROM Persons
    GROUP BY Persons.Mother, Persons.Father
    PIVOT "Child" & DCount("*","Persons","Mother & Father='" & [Mother] & [Father] & "' AND ID<" & [ID])+1;
    

    Alternative involves VBA procedure writing records to another table.

    0 讨论(0)
提交回复
热议问题