🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #1475

Re: problema join con mysql

#1475
From: Rickoj
Date: Fri, 04 Aug 2006 21:37
42 lines
2285 bytes
"Mauricio G�mez" <pregunte@sileinteresa.com> escribi� en el mensaje 
news:eb0dgi$2b6$1@news.nivel5.cl...
>y c.rut en vez de clientes.rut en el select?

pero c.rut no lo tomaria ya que el alias lo estoy escribiendo en el from
a menos que vea con un as
voy a intentar pero creo que ya lo hbaia hecho

> rro
>
>
> Rick_oj escribi�:
>> tengo las siguientes tablas
>> CREATE TABLE `clientes` (
>>   `rut` int(9) NOT NULL,
>>   `ap_paterno` varchar(50) NOT NULL,
>>   `ap_matern` varchar(50) NOT NULL,
>>   `nombres` varchar(100) NOT NULL,
>>   `compra` varchar(10) NOT NULL,
>>   UNIQUE KEY `rut` (`rut`)
>> ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
>>
>> CREATE TABLE `productos` (
>>   `rut` int(9) NOT NULL,
>>   `items` varchar(1) NOT NULL,
>>   // otros campos//
>>  UNIQUE KEY `rut` (`rut`)
>> ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
>>
>> y la siguiente sentencia sql
>> SELECT `ap_paterno`,`ap_matern`,`clientes`.`rut`,`items`
>> FROM clientes c join productos p
>> WHERE c.rut=p.rut and c.compra='efectuada'
>>
>> mysql responde "rut is ambigous" por que el rut es el mismo en ambas 
>> tablas
>> se que si hago select * from.... funciona
>> el asunto es que no me interesa rescatar los "otros campos", ahora podria 
>> rescatarlos y no despleglarlos pero no es la idea
>>
>> 
Technical Details
Message-ID: <eb0epk$2nc$1@news.nivel5.cl>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!nntp-server.pubsub.com!news.nivel5.cl!not-for-mail
References: <eb0aea$1bh$1@news.nivel5.cl> <eb0dgi$2b6$1@news.nivel5.cl>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,599d380b0a5f3acc
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!nntp-server.pubsub.com!news.nivel5.cl!not-for-mail
From: "Rick_oj" <rick_oj@[sin-esto]tutopia.com>
Newsgroups: chile.comp.programacion
Subject: Re: problema join con mysql
Date: Fri, 4 Aug 2006 17:37:47 -0400
Organization: Varios
Lines: 43
Message-ID: <eb0epk$2nc$1@news.nivel5.cl>
References: <eb0aea$1bh$1@news.nivel5.cl> <eb0dgi$2b6$1@news.nivel5.cl>
NNTP-Posting-Host: pc-211-201-120-200.cm.vtr.net
X-Trace: news.nivel5.cl 1154727540 2796 200.120.201.211 (4 Aug 2006 21:39:00 GMT)
X-Complaints-To: news@news.nivel5.cl
NNTP-Posting-Date: Fri, 4 Aug 2006 21:39:00 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
X-RFC2646: Format=Flowed; Response