I have two tables:
Table "Card" with the following columns: no, student_no, parent_no, teacher_no.
Table "Card_log" with the following columns: card_no, access_time
Table "Card_log" have the column "card_no" which refer to the "no" of table "Card".
no | student_no | parent_no | teacher_no
1 250 NULL NULL
2 NULL 101 NULL
3 NULL NULL 32
How can I write the select statement so that it can clearly know which number (student_no, parent_no or teacher_no) to be selected when "no" is read?
Eg: When "card_no" in table "Card_log" is 2, then I will read the table "card" can then retrieve parent_no=101. When "no" is 3, then i can retrieve teacher_no=32