Another querry problem
-
some personeel have education history others have short course history I have 3 tables: Personeel, Courses and Education. Personeel table have primary key persId which is foreign in the other 2. My question: How do I get the personel details of: those havin education history those having course history Combine the above two in one list and display as just a single list in a datagrid? This will become the list of active employees. How will the querry look like and what other things do I need to do... I have tried several things out but I am really stuck. Thanks alot, Commickey
-
some personeel have education history others have short course history I have 3 tables: Personeel, Courses and Education. Personeel table have primary key persId which is foreign in the other 2. My question: How do I get the personel details of: those havin education history those having course history Combine the above two in one list and display as just a single list in a datagrid? This will become the list of active employees. How will the querry look like and what other things do I need to do... I have tried several things out but I am really stuck. Thanks alot, Commickey
SELECT P.ID FROM PERSONNEL AS P INNER JOIN COURSES AS C ON P.ID = C.PERSONNEL_ID INNER JOIN EDUCATION AS E ON P.ID = E.PERSONNEL_ID
Could try something like that, but without really knowing your table structure it's hard to say. If you have course items and education items, you should probably think about many-to-many linking tables in between these and personnel. This will save duplication of all the course details.