Hi and Hello is anyone know on you can I construct a query for this?
student_subjects
15-01785 , Test
15-01785 , Test1
15-01785 , Test2
15-01785 , Test3
15-01785 , Test4
15-01786 , Test
15-01786 , Test1
15-01786 , Test2
15-01786 , Test3
15-01786 , Test4
this is my record in the database … I try to spend many days for finding a solution for this … please help me
I want to make an query that results like this but i don’t have any idea .
15-01785 , Test
15-01785 , Test1
15-01785 , Test2
15-01785 , Test3
15-01785 , Test4
15-01786 , Test
15-01786 , Test1
15-01786 , Test2
15-01786 , Test3
15-01786 , Test4 …
And now you know the reason why.
If you want to do this all in the sql query, without post-processing the data in php, a better database design is the answer.
I assume that since this is a temporary table, then the real tables you want to insert this into is normalized. I.e. the student is linked by a linking table to the subjects. Then the subjects are linked towards the departments, and also linked towards the instructors.
What you need to do is clean the data using PHP and then insert it properly. I.e. pull the data, then use explode on the strings to create the arrays, then match them properly when inserting into the tables (i.e. subject[0] would be tied to department[0] etc. or at least that is how it looks.)