Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2002
    Posts
    2

    Unanswered: Select statements

    How come the below statement works with a MS Acces but not with Mysql? Is there a way to write a statement in mysql which does the same thing?

    SELECT * FROM (SELECT FOR_ID, FOR_NAME, FOR_AUTHOR, FOR_DATE, FOR_DESCRIPTION, (SELECT COUNT (*) FROM MESSAGES WHERE MESSAGES.FOR_ID = FORUMS.FOR_ID) AS NO_TOPIC, (SELECT COUNT (*) FROM REPLIES WHERE REPLIES.FOR_ID = FORUMS.FOR_ID) + NO_TOPIC AS NO_POST, (SELECT MAX (REP_DATE)
    FROM REPLIES
    WHERE REPLIES.FOR_ID = FORUMS.FOR_ID) AS LAST_POST FROM FORUMS)
    ORDER BY LAST_POST DESC

  2. #2
    Join Date
    Jan 2002
    Posts
    11

    because...

    MySQL doesn't support sub-selects.

  3. #3
    Join Date
    Feb 2002
    Posts
    2
    Sooo...
    My only option is to create a seperate recordset for each statement?

  4. #4
    Join Date
    Feb 2002
    Location
    New Jersey
    Posts
    39
    You can achieve the same effect as sub-selects via joins. Check the manual.

    MySQL Manual

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •