Syntax error with MySql

Results 1 to 3 of 3

Thread: Syntax error with MySql

  1. #1
    Join Date
    Dec 1969

    Default Syntax error with MySql

    If I write "SELECT cust_id FROM table1 WHERE table1.cust_id IN (1203)" I have no problems. <BR><BR>If I write "SELECT cust_id FROM table1 WHERE table1.cust_id IN (SELECT cust_id FROM table2)" I receive a Sql syntax error. What am I doing wrong?<BR>

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default Whats the error?? <eop>


  3. #3
    Join Date
    Dec 1969

    Default Read the docs...

    MySQL does NOT support NESTED SELECTS.<BR><BR>It&#039;s one of the first things they mention in "unsupported features."<BR><BR>But I don&#039;t understand why you would write a query like that for ANY db!<BR><BR> SELECT cust_id FROM table1, table2 WHERE table1.cust_id = table2.cust_id<BR><BR>More efficient, anyway.<BR><BR>It&#039;s true that the *inverse* (find all in table1 who are *NOT* in table2) is tougher to do without the nested select. But this way? No reason to use it.<BR><BR>

Posting Permissions

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