Dave Tolls wrote:It's in one row because you are concatenating all the subjects selected together into a single comma-separated string.
Here, for example:
To have multiple rows from this data you need to do multiple INSERTS, one for each subject, mapping it to a student
Dave Tolls wrote:To have multiple rows from this data you need to do multiple INSERTS, one for each subject, mapping it to a student.
Dave Tolls wrote:
1. Create the STUDENT row, which only needs the TYPE and CATEGORY, hopefully your database can auto-generate an ID.
(Note your STUDENT table should not have a SUBJECTID. SUBJECTS are handled by a STUDENT_SUBJECT mapping table.)
2. For each id in the subjectIds array, INSERT an entry in the STUDENT_SUBJECT table, using the STUDENTID and SUBJECTID.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your databasehttps://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database