applicationMySQLには、、、questionsおよびの3つのテーブルがありますquestions_answer。
application店舗user_id; questions店舗question_idとtype of questions(すなわち、名前、NRIC、学校の名前); およびへの参照をquestions_answer格納します。answersuser_idquestion_id
私が理解していることから、このタイプの関連付けはポリモーフィックな関連付けと呼ばれます。今、私は別のquestion_idからデータを取得し、代わりにそれらを列ヘッダーとして作成する方法に迷っています。
それが理にかなっていることを願っています。
編集:
説明のために、それぞれの表を次に示します。
application:
user_id name
-------------------------------
100 Leon Barnacles
101 Richard Kennard
102 Fareeza Salleh
questions:
question_id question_name
---------------------------------------------
20 NRIC
21 Have you ever applied to TFM?
22 What's your current GPA?
23 Name of school
questions_answer:
question_id user_id answer
------------------------------------------------
20 100 880808-06-8990
20 100 900990-14-0911
23 102 SMK Taman Pandamaran
私が取得したいもの:
Name NRIC Name of school
------------------------------------------------------------
Leon Barnacles 880808-06-8990
Richard Kennard 900990-14-0911
Fareeza Salleh SMK Taman Pandamaran