I have two different tables. One is instructor and second is student. Both table structure are as follows:
________INSTRUCTOR_________
instructorid schoolid instructorusername instructorfirstname instructorlastname instructortitle level
1 1 inst_A first_A Last_A RN 3
2 1 inst_B first_B Last_B TD 3
3 1 inst_C first_C Last_C FP 3
________STUDENT_________
studentid schoolid studentusername studentfirstname studentlastname level
1 1 stud_A first_A Last_A 4
2 1 stud_B first_B Last_B 4
3 1 stud_C first_C Last_C 4
Now, I want to select data from both tables where schoolid is ‘1’ and the result will be like Bellow :
________RESULT_________
id schoolid username firstname lastname title level
1 1 inst_A first_A Last_A RN 3
2 1 inst_B first_B Last_B TD 3
3 1 inst_C first_C Last_C FP 3
1 1 stud_A first_A Last_A 4
2 1 stud_B first_B Last_B 4
3 1 stud_C first_C Last_C 4
Is there any way to do like this? Please can any one help me for this. I have never done like this before.
Thank you in Advance
use
UNION ALL(actually justUNIONwill do since students have no title). SInce tableSTUDENTdoesn’t have title, you need to have an empty column with aliastitleso it will match the column count. If you don’t add extra column for title, you will have error messageFull Query,