SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    UK
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Syntax error please advise

    Hi

    I want to do a simple query through phpMyAdmin

    SELECT * FROM posts WHERE id IN (SELECT postId FROM keyphrases WHERE phrase LIKE '%phrase%') LIMIT 0, 30;

    but I get Error Code : 1064 You have an error in your SQL syntax.

    SELECT postId FROM keyphrases WHERE phrase LIKE '%phrase%' works fine as does

    SELECT * FROM posts WHERE id IN (14,15,16)

    Can someone please tell me what I'm doing wrong.

    Thanks Chris

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,247
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    "Your error suggests that you are running an old version of mysql that does not support subqueries."

    (thanks for the line, guelphdad)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    UK
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    phpinfo says i'm running 5.0.15 is that not suufficient. if not what can i do as a work around?

    oops no i'm not I've got i'm running mysql 4

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    phpinfo() only reports the version of the client that the mysql or mysqli extension is based on. you don't specify which mysql server to connect to when calling phpinfo(), so how could it possibly know what version the server is?


Bookmarks

Posting Permissions

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