La colonne "xxxx" dans la clause where est ambiguë.

Solved
alkatraz -  
crapoulou Posted messages 28002 Registration date   Status Moderator, Security Contributor Last intervention   -
Hello,

I have a little issue with my search engine. I have 3 tables (similar, just the table name changes): c0de, p4per, v1deo and in each of them, there are 3 columns: date, title, author and I would like to perform a search across all the columns.

I tried this:
SELECT date,title,author FROM c0de,p4per,v1deo WHERE date LIKE "%$find%" OR title LIKE "%$find%" OR author LIKE "%$find%" ORDER BY date DESC LIMIT '.$Limit.','.$Site['LinesPerTable'];


But it seems that it doesn't work... I have a SQL error
Column "xxxx" in where clause is ambiguous


I am a beginner and I would like to understand why. I have seen that it's a conflict with column names but I didn't understand the solutions proposed by some sites.

Thank you
Configuration: Windows 7 / Firefox 3.6.8

10 answers

  1. A.Nonymous
     
    It's silly to say, but
    "Column "xxxx" in where clause is ambiguous"
    means that there is ambiguity regarding the column "xxxx" used in the "where"

    The way to resolve this ambiguity is to specify this column with the desired associated table

    WHERE date LIKE "%$find%"
    could become
    WHERE p4per.date LIKE "%$find%"
    2
    1. crapoulou Posted messages 28002 Registration date   Status Moderator, Security Contributor Last intervention   8 046
       
      Thank you for your insight ;-).
      Problem solved.
      0