jadams0173
Technical User
- Feb 18, 2005
- 1,210
Hi all. I've used the answer in thread183-1571629 to unpivot a sql 2000 table. Now I need to take it one step further but I'm not sure where to start. I now have data that looks like this.
is there anyway to format the data so it is displayed with the parent and then all the child assy's without repeating PARENT for each record. This would require taking out the parent records in [red] red [/red]:
Here is the source query for the recordset
Code:
RELATIONSHIP ASSY
PARENT 011212001013T
CHILD 120989007013
PARENT 011212001013T
CHILD 120989010013
PARENT 011212001013T
CHILD 120989022013
PARENT 011212002013G
CHILD 120989007013
PARENT 011212002013G
CHILD 120989010013
PARENT 011212002013G
CHILD 120989022013
is there anyway to format the data so it is displayed with the parent and then all the child assy's without repeating PARENT for each record. This would require taking out the parent records in [red] red [/red]:
Code:
RELATIONSHIP ASSY
PARENT 011212001013T
CHILD 120989007013
[red]PARENT 011212001013T[/red]
CHILD 120989010013
[red]PARENT 011212001013T[/red]
CHILD 120989022013
PARENT 011212002013G
CHILD 120989007013
[red]PARENT 011212002013G[/red]
CHILD 120989010013
[red]PARENT 011212002013G[/red]
CHILD 120989022013
Here is the source query for the recordset
Code:
SELECT * FROM (
SELECT
RELATIONSHIP,
ASSY =
CASE N
WHEN 1 THEN "Parent"
WHEN 2 THEN "Child"
--WHEN 3 THEN Col3
--WHEN 4 THEN Col4
END
FROM
V_Parent_Child_EDS T
CROSS JOIN (
SELECT 1, 'PARENT' UNION ALL SELECT 2, 'CHILD'
) X (n, RELATIONSHIP)
) Z
WHERE ASSY <> ''