Subqueries problem

Discussion in 'MySQL' started by hayunna, Jun 26, 2007.

  1. #1
    hi everyone,

    i'm having a trouble in running SQL subqueries in Linux. it works fine in Windows XP but not in Linux Suse 9.x. i use PHP4.X.X and MySQL 4.X.X in both platforms. even the simplest command:

    select a.col_id, (select count(*) from tbl2 b where b.col_id = a.col_id) from tbl1 a where a.date >= '2007-06-01 and a.date <= '2007-06-10';

    i'm just a beginner..please help..

    thanks in advance...

    regards,
    -hayunna :)
     
    hayunna, Jun 26, 2007 IP
  2. zonzon

    zonzon Peon

    Messages:
    100
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    which error message it gives to you?
     
    zonzon, Jun 26, 2007 IP
  3. KalvinB

    KalvinB Peon

    Messages:
    2,787
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Which version of MySQL are you running on the Linux box?

    Subqueries are a relatively new thing and not all versions of MySQL 4 support them.

    If you can, I'd recommend upgrading to MySQL 5.
     
    KalvinB, Jun 26, 2007 IP
  4. hayunna

    hayunna Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    it gives me an error that i have an SQL syntax, tho' i know it's correct, because it works for windows.

    i've just read when i googled about this problem that subqueries, such as the one i've mentioned, is not supported with MySQL 4.0, which we are running in our web server. i am still considering upgrade from PHP 4 to PHP 5 and MySQL 4 to MySQL 5. but the problem is, i'm not used with Linux scripting. i don't know how to install something or upgrade the package/version of an existing software. i'm afraid that i might destroy our web server if i do some experimentations on it. perhaps i'll do a deeper research on how to do all these stuff. can you help me with this?

    thanks.
     
    hayunna, Jun 26, 2007 IP
  5. zonzon

    zonzon Peon

    Messages:
    100
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    what OS are you running on your server? If linux, which distribu and version?
     
    zonzon, Jun 26, 2007 IP
  6. hayunna

    hayunna Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    it's Linux Suse 9
     
    hayunna, Jun 26, 2007 IP