Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Posts
    13

    Unanswered: ERROR 1064 on IN statement

    I would like to get a list of "documents" not locked with this statement
    Code:
    SELECT F_DOCUMENT_ID FROM T_DOCUMENT WHERE F_DOCUMENT_ID  <> ANY ( SELECT F_DOCUMENT_ID FROM T_DOCUMENT_LOCK )
    however I get only this error
    Code:
    [DB] ERROR 1064: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '( SELECT F_DOCUMENT_ID FROM T_DOCUMENT_LOCK )' at line 1
    I looked up the MySQL docs, but it seems to be right...
    Anyone a clue?

    thanks,
    kromo

  2. #2
    Join Date
    Nov 2003
    Posts
    91
    try this,

    SELECT f_document_id
    FROM t_document d LEFT JOIN t_document_lock c
    ON d.f_document_id = c.f_document_id
    WHERE c.f_document_id IS NULL

    what version of MySQL are you using?
    only versions 4.1+ are capable of subselects.

Posting Permissions

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