WTH is wrong with this MySql statement?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alex79
    Confirmed User
    • Jun 2002
    • 996

    #1

    WTH is wrong with this MySql statement?

    Code:
    SELECT id FROM `table1` WHERE id NOT IN ( SELECT id FROM `table2` )
    i get an #1064 - You have an error in your SQL syntax near 'SELECT id FROM `table1` error message
  • FuqALot
    Confirmed User
    • Dec 2001
    • 3817

    #2
    try `table1` without quotes, and `table2` without quotes too.

    and fyi, u need a pretty new mysql version to use query with query.. but first u should try without the quote.

    Comment

    • psili
      Confirmed User
      • Apr 2003
      • 5526

      #3
      You could try:

      SELECT id FROM table1 LEFT JOIN table2 WHERE table2.id IS NULL
      Your post count means nothing.

      Comment

      • CaptainHowdy
        Too lazy to set a custom title
        • Dec 2004
        • 94735

        #4
        Originally posted by psili
        You could try:

        SELECT id FROM table1 LEFT JOIN table2 WHERE table2.id IS NULL
        !!

        Comment

        Working...