Web Analytics Made Easy -
StatCounter 1064: Syntax error in mySql - CodingForum

Announcement

Collapse
No announcement yet.

1064: Syntax error in mySql

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 1064: Syntax error in mySql

    Hello,

    I want to execute a simple request SQL on the MySql shell,

    On DB2 and solid this line work perfectly, but under mySql i get an error.

    This is the error:

    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 'exists (SELECT Table_2.Tab1ID FROM Rdv WHERE Table_2.Tab1ID = 1


    This is the line to execute:

    DELETE FROM Table_1 WHERE ((Table_1.ID = 123456) AND not exists (SELECT Table_2.Tab1ID FROM Rdv WHERE Table_2.Tab1ID = 123456));

    Anyone have an idea of the source of the problem??

    Thank you,

  • #2
    mySQL only has support for sebselects from version 4.1 on. So check your version.

    But your subselect is something quite strange ...
    SELECT Table_2.Tab1ID FROM Rdv WHERE Table_2.Tab1ID = 123456
    --> the only thing that can possebly return is 123456 and it is completely pointless to specify a returned column since exist only evaluates to true or false..
    --> SELECT Table_2.Tab1ID FROM Rdv ???

    I suppose you want something like
    DELETE FROM Table_1 WHERE ((ID = 123456) AND (123456 Not In (SELECT Tab1ID FROM Table_2 ));
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

    Comment

    Working...
    X