Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2005
    Posts
    4

    Unanswered: Syntax in different versions of php mysql Client API

    So I run this qry via phpmyadmin with php mysql Client API v. 3.23.49.

    Code:
    SELECT
    `shownum`, `showdate`, `showdesc`, `venue`, `city`, `state`
    FROM `table1`
    WHERE `showdate`
    NOT IN
    (SELECT DISTINCT(`date`) FROM `table2`)
    This works fine until I run the same qry on an identical database on my host's server with php mysql Client API v. 4.0.25. MySQL throws the following 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 `date` FROM `table2 ` ) LIMIT 0, 30' at line

    Is my syntax really incorrect or do the different versions dislike my 'nested' SELECT statement?
    Last edited by yebot; 11-28-05 at 07:50.

  2. #2
    Join Date
    Apr 2005
    Location
    Lier, Belgium
    Posts
    122
    Quote Originally Posted by yebot
    Is my syntax really incorrect or do the different versions dislike my 'nested' SELECT statement?
    'Nested' SELECT statements are supported from MySQL 4.1 onwards.

    --
    felix

  3. #3
    Join Date
    Aug 2005
    Posts
    4
    Thanks Felix.


    I have Table1 where each record has a 'showdate'. Then in table2, there will be a series of records that have a 'date' that should correspond to a date in the Table1 'showdate'.

    I want to run a qry that will show me all records in Table1 where Table1.showdate does not have at least one match in Table2.date.

    Since my host is using MySQL 4.0.25, how can I accomplish this without using a 'nested' SELECT?

  4. #4
    Join Date
    Apr 2005
    Location
    Lier, Belgium
    Posts
    122
    Quote Originally Posted by yebot
    I want to run a qry that will show me all records in Table1 where Table1.showdate does not have at least one match in Table2.date.
    Code:
    SELECT
      Table1.*
    FROM Table1
    LEFT JOIN Table2 ON Table2.date = Table1.showdate
    WHERE
      Table2.date IS NULL
    --
    felix

Posting Permissions

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