If this is a DBA question, feel free to let me know.
We have data that is stored in an SQL database that needs to be exported, so it can be converted into a new software package. Currently, we have a parent recordset and a child recordset that needs to be combined because the new system has the ability to track what was in a child recordset on the parent. I hope this makes sense.
Parent Recordset
ID | Description
-- | -----------
1 | Item 1
2 | Item 2
3 | Item 3
Child recordset
Parent ID | Code | Value (string)
--------- | ----------- | -------------------
1 | PSI | 75
1 | SIZE | 2 1/2"
2 | CFM | 9200
2 | BELT | BROWING - A76
2 | RPM | 722
3 | PSI | 45
3 | SIZE | 1"
Ideally, we need a CSV file (in the end) that somehow looks like:
ID | Description | PSI | SIZE | CFM | BELT | RPM
-- | -----------
1 | Item 1
2 | Item 2
3 | Item 3
You get the picture.
I don't care if it's done in SQL, Excel, Access, or some magic (trying to avoid writing a program), I am trying to save the time it would take a staff member to manually change the order or type it in. Any ideas on how to make this easy to change around? We are talking about 5700 child records and 5900 parent records. Is there some SQL magic that can do this?
I did think about adding each column individually (e.g. (select value from child where id = parent id and code = 'RPM') as RPM
) but with 157 different codes, that isn't ideal either.