Click here to Skip to main content
14,974,899 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two tables like

TABLE 1 : FACULTY_DETAILS

fac_det_id(pk)........fname...........availability
.....1......................... xxx.................full time
.....2......................... yyy.................part time
.....3......................... zzz.................weekdays
.....4......................... aaa.................partime

TABLE 2: FACULTY

faculty_id(pk)..........course_id........fac_det_id(fk)
.....1..............................1......................2
.....2..............................2......................3
.....3..............................3......................1
.....4..............................4......................3
.....5..............................3......................4

when i give course id
i need fname ,availability in table1 and faculty_id in table 2

ie if i give course_id=3 then i need like

faculty_id..........fname...........qualification
.....2...................xxx................full time
.....5...................aaa................partime
Posted

SQL
SELECT fname, availability, faculty_id
FROM faculty a, faculty_details b
WHERE a.fac_det_id = b.fac_det_id
AND course_id =1

solved myself
   
SQL
select  faculty_id,fname,availability
from table1 t1
JOIN table2 t2
ON t1.fdId=t2.fdId
where courseid =3
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900