Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    2

    Unanswered: newbie question: subqueries

    well it is quite strange, but when trying to execute any query with subquery i get parsing error (1064), no matter that i tried in phpmyadmin (could have been something related to that app.) and inside php code; i also tried in diferent hosts ( diferent MySQL installations)

    well i tried a basic example of scalar subquery,from MySQL online doc, 13.1.8.1 section ( i have also tried with row subqueries ...) :

    CREATE TABLE t1 (s1 INT);
    INSERT INTO t1 VALUES (1);
    CREATE TABLE t2 (s1 INT);
    INSERT INTO t2 VALUES (2);

    and then :

    SELECT (SELECT s1 FROM t2) FROM t1;

    so, then, mysql returns:

    "
    SELECT (


    SELECT s1
    FROM t2
    )
    FROM t1
    LIMIT 0 , 30

    MySQL said:


    #1064 - You have an error in your SQL syntax near 'SELECT s1
    FROM t2 )
    FROM t1 LIMIT 0, 30' at line 2
    "
    well i have tried typing each char, also putting diferent quotes to fields,
    and nothing; the inner query executed itself works perfectly, as well; so,
    how is it possible to have a parsing error there ?;

    do tables need any specific configuration?

    thanks in advance for any answer ...

  2. #2
    Join Date
    Feb 2004
    Location
    Siggenthal, Switzerland
    Posts
    19
    In order to use subqueries in MySQL you will need a version of MySQL 4.1.

    Which version do you have ?

    Walter

  3. #3
    Join Date
    Feb 2004
    Posts
    2
    hi, oh well i didnt thought on it as a version issue! thought mysql already supposrted them! i use some already old 3.23.51 ... in own puter and at a remote server;

    i had already thought on upgrading version to 4.x, so finally i will have to, at least at own puter, though i will still have to check that matter of checking or fixing DB users table perms, i think i read at Mysql website ..., no? ;

    at remote server it will be mostly impossible to upgrade, so i will have to think on a php solution (2 indenpendient queries ..), though it will get slower ...

    tyvm !!

Posting Permissions

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