I have 2 tables - student table, contact table
Student table:
student_id (key)
fname
lname
Contact table:
student_id (key)
contact_id (key)
fname
lname
phone
Multiple contact records for each student id - max I have found is 10 records
student_id, phone
11111, 5551212
11111, 5553434
11111, 5558585
22222, 5555555
33333, 5555558
33333, 5555559
33333, 5555577
33333, 5555666
I need 1 row as follows:
student_id, phone1, phone2, phone3
11111, 5551212, 5553434, 5558585
22222, 5555555, null, null
33333, 5555558, 555559, 5555577
student 33333 has 4 records but I only need 3 results like above - I don't care what 3 but only 3. As stated some student_id's have as many as 10 contact phones.
Thanks in advance.
Student table:
student_id (key)
fname
lname
Contact table:
student_id (key)
contact_id (key)
fname
lname
phone
Multiple contact records for each student id - max I have found is 10 records
student_id, phone
11111, 5551212
11111, 5553434
11111, 5558585
22222, 5555555
33333, 5555558
33333, 5555559
33333, 5555577
33333, 5555666
I need 1 row as follows:
student_id, phone1, phone2, phone3
11111, 5551212, 5553434, 5558585
22222, 5555555, null, null
33333, 5555558, 555559, 5555577
student 33333 has 4 records but I only need 3 results like above - I don't care what 3 but only 3. As stated some student_id's have as many as 10 contact phones.
Thanks in advance.