mySQL query without subselects

wxdqz

New Member
According to the documentation, mySQL does not support subselects in queries... so i'm not exactly sure if this is possible to do in one query statement.

I'm setting up a forum, where I have 3 basic tables.

forum_msgs, forum_threads, forum_forums.

forum_msgs has an msgID and a threadID (along with other msg information)

forum_threads has a threadID and a forumID (along with other thread information)

forum_forums has a forumID and a projID (each forum is attached to a particular project in another table)

What I would like to do is given a msgID, find out what the projID is.

Using subselects, it would be something like:
SELECT f.projID FROM forum_forums f WHERE f.forumID = (SELECT t.forumID FROM forum_threads t WHERE t.threadID = (SELECT m.threadID FROM forum_msgs m WHERE m.msgID = $someMsgID))

How can I do this query in mySQL which doesn't support subselects? and possibly without doing like 3 separate queries.
 
Back
Top