M
mscertified
Does anyone have SQL that can be used to 'flatten' a self-referencing table:
Table format:
ID
Data
ParID (refers to ID of another record)
I need this converted to a table with format:
Data1
Data2
Data3
Where the columns are the individal 'paths' of the tree, e.g.
1 Car 0
2 Buick 1
3 Chevy 1
4 Regal 2
5 Corvette 3
6 Malibu 3
Would be converted to:
Car, Buick, Regal
Car, Chevy, Corvette
Car, Chevy, Malibu
Table format:
ID
Data
ParID (refers to ID of another record)
I need this converted to a table with format:
Data1
Data2
Data3
Where the columns are the individal 'paths' of the tree, e.g.
1 Car 0
2 Buick 1
3 Chevy 1
4 Regal 2
5 Corvette 3
6 Malibu 3
Would be converted to:
Car, Buick, Regal
Car, Chevy, Corvette
Car, Chevy, Malibu