Re: Query bug

From: Date: Wed, 27 Mar 2002 21:28:31 +0000
Subject: Re: Query bug
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-90430@lists.php.net to get a copy of this message
This way works, but not the way i would like to. Because it selects just the fields "nome","id_proj" and "arquivo" from the table ALGORITMO, and here my goal is to select those fileds of ALGORITMO and ATAS. "Erik Price" <pricee@hhbrown.com> wrote in message news:CD71C946-41C7-11D6-BDC2-0050E4857868@hhbrown.com... > > 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, > ATAS > WHERE 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 >

« previous php.general (#90430) next »