No announcement yet.

SQL Join query

  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL Join query

    Hi community,

    I've never dealt with a join query code before and I'm having problems fixing this one. Here it is:

    safe_query("select ca.status, ca.ID, from ".PREFIX."cup_all_clans ca,cups c WHERE ca.ID = c.ID and c.ID=$cupID");
    So I'm selecting status, ID and name from "cup_all_clans" table and WHERE ID = $cupID from "cups" table. I get error despite the query selecting the correct cupID from the correct table, but it says it does not exist?

    # errorno=1146
    # error=Table 'ficomedi_ficomedia.cups' doesn't exist
    # query=select ca.status, ca.ID, from ficocup_cup_all_clans ficocup_ca,cups c WHERE ca.ID = c.ID and c.ID=4

    "ficomedi_" is prefix, not sure why it's reading prefix twice followed by a dot as you can see in the error?

    Take a look at my table structures. First one being cups table and second cup_all_clans table.
    Attached Files
    Last edited by karimali831; 27-02-10, 06:20 PM.