Sir, I now doing the joining of Two table in SQL Server.
My Tables are:-1. tbl_Subject(subjectId(pk),subjectName,teacherId(fk)),2.tbl_Teacher(teacherId(pk),teacherName)
There are 10 subjects with subjectId:-1.Malayalam,2.English,3.Hindi
Teacher with teacherId:-1.Mahesh,2.Hameed,3.Rao,4.Jasni
in this Mahesh teaching Hindi and English,
The question is :- find out the teacher teaching more than one subject?
I want your help in this problem. send me the right code.
Loading

Pankaj PandeyPosted Jun 5, 2013, 2:07 AM
IF YOU WANT TO SHOW DETAIL OF TEACHER WHO TEACH MORE THEN ONE SUBJECT THEN TRY THIS QUERY.
FOR ANY...
Bineesh ViswanathPosted Jun 5, 2013, 2:51 AM
Sunny SharmaPosted Jun 5, 2013, 1:58 AM
use the below query
------------------------------
SELECT teacherName
FROM tbl_Teacher a
INNER JOIN
tbl_Subject b
ON
a.teacherId=b.teacherId
GROUP BY teacherName HAVING COUNT(subjectName)>1
------------------------------
Mark it as answer if it helps!
Cheers.