Morpheus7
asked on
Moving data from one table structure to different table structure
Hi,
We currently have the following table with the following columns:
AnimalID OrderNo, TestA TestA_Result TestB TestB_Result TestC TestC_Result
I would like to be able to move the data to a table that has one row per test, as opposed to the current one where there is one row per animal
Like so
AnimalID OrderNo TestA testAResult
12345 09890 TestA Neg
12345 09890 TestC Pos
12345 09890 TestC IC
All fields are VARCHAR or CHAR
Any assistance would be appreciated
Thanks
We currently have the following table with the following columns:
AnimalID OrderNo, TestA TestA_Result TestB TestB_Result TestC TestC_Result
I would like to be able to move the data to a table that has one row per test, as opposed to the current one where there is one row per animal
Like so
AnimalID OrderNo TestA testAResult
12345 09890 TestA Neg
12345 09890 TestC Pos
12345 09890 TestC IC
All fields are VARCHAR or CHAR
Any assistance would be appreciated
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
From myTable
UNION ALL
Select AnimalID, OrderNo, TestB, TestB_Result
From myTable
UNION ALL
Select AnimalID, OrderNo, TestC, TestC_Result
From myTable