Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: SQL Query From two Table satisfying a condition

HiddenHopes:


Table 1 name: Student
Name Department
Alex CSE
Bob EEE
Briyan ME
John CSE
James ETE
Mike CE

Table 2 name: Program
Department Semester
CSE Summer
CSE Winter
EEE Summer
ETE Summer
ME Winter
CE Summer
CE Winter

What is the Sql Query to print the names and the Semester where each student's department have only 1 type of semester? (the server is mysql)


SQL Query Result should be like this:
Name Semester
Bob Summer
Briyan Winter
James Summer

Here, CSE and CE have both Summer and winter semester. So Alex, John and Mike are not included.

I have tried this far:


SELECT Student.Name,
Program.Semester
FROM Student
JOIN Program
ON Program.Department = Student.Department
WHERE ....



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: SQL Query From two Table satisfying a condition

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×