Re: Query bug
| From: | Erik Price | Date: | Wed, 27 Mar 2002 21:15:45 +0000 |
| Subject: | Re: Query bug | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90428@lists.php.net to get a copy of this message | ||
On Wednesday, March 27, 2002, at 04:00 PM, Daniel Ferreira Castro wrote:
I want to select the fields nome,id_proj,arquivo FROM ALGORITMO and ATAS. But when I use the query below, I receive the error "ERROR 1052: Column: 'nome' in field list is ambiguous". What is wrong on my query? query: SELECT nome,id_proj,arquivo FROM ALGORITMO,ATAS WHERE id_proj=0 AND eng=1 OR nome="teste" OR nome="de" OR nome="parse";Daniel, try specifying which table you want the 'nome' column to be used in -- the ambiguous part is that many of the tables you are selecting FROM have a 'nome' column. Do it like this: SELECT ALGORITMO.nome,
ALGORITMO.id_proj,
ATAS.arquivo
FROM ALGORITMO,
ATASWHERE ALGORITMO.id_proj=0
AND ALGORITMO.eng=1 OR ALGORITMO.nome="teste" OR ATAS.nome="de" OR ATAS.nome="parse";Obviously, I have no idea how you want your query to look, so be sure to customize it for your needs, but this demonstrates what you need to do: Explicitly state the table whose column you want to access. Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com