I have a normalized table (table a) and a non-normalized table (table b), like this:

Basically, for each row in table a for the same student ID, I want to read all the parents with the same studentId and put the data into one row in table B.
So if I have 3 rows in table A, then there would be one row in table B with 3 of the 4 parent fields filled in. Any help for an SQl query for this would be appreciated.
Sample for data in table A
parentID studentID parentName
1 1 test
2 1 test1
Result I want in table B
studentID parent1 parent2
1 test test1
Here’s a query that would generate the flat results you are looking for. Is there a reason you couldn’t just make this a view instead of permanently restructuring your data?
Demo: http://www.sqlfiddle.com/#!3/91843/9
To push this data into
FlatFamilyyou would use anINSERT...SELECT: