#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    6
    Rep Power
    0

    nested query and MySQL query


    I have read somewhere that MySQL doesn't support nested query. And some other web also said that nested statements are support after version 4.1. Well, I tried my nested query and it doesn't work. So I have tried to convert my nested query to non-nested query for a week, and I still can't figure it out. The query is to select the course that student is not enrolling. The coursetaken table is the join table of the course table and the student table.

    student(loginID, passwd, name)
    course(courseID, Title, CRHours)
    coursetaken(loginID, courseID)

    SELECT courseID, title FROM course WHERE courseID not in
    (SELECT courseID FROM coursetaken WHERE loginID = (SELECT loginID FROM student WHERE loginID ='john001'));

    Could you help me convert this query to non-nested query. Thanks.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    MD
    Posts
    373
    Rep Power
    16
    see if my final answer on http://forums.devshed.com/showthread...661#post436661 is the correct solution,

IMN logo majestic logo threadwatch logo seochat tools logo