🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #1473

Re: problema join con mysql

#1473
From: Mauricio Gómez
Date: Fri, 04 Aug 2006 20:36
37 lines
2033 bytes
y c.rut en vez de clientes.rut en el select?


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: <eb0de9$2b5$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>

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: Mauricio Gómez <pregunte@sileinteresa.com>
Newsgroups: chile.comp.programacion
Subject: Re: problema join con mysql
Date: Fri, 04 Aug 2006 17:36:08 -0300
Organization: Varios
Lines: 37
Message-ID: <eb0de9$2b5$1@news.nivel5.cl>
References: <eb0aea$1bh$1@news.nivel5.cl>
NNTP-Posting-Host: pc-23-73-104-200.cm.vtr.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.nivel5.cl 1154726153 2405 200.104.73.23 (4 Aug 2006 21:15:53 GMT)
X-Complaints-To: news@news.nivel5.cl
NNTP-Posting-Date: Fri, 4 Aug 2006 21:15:53 +0000 (UTC)
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: es-es, es
In-Reply-To: <eb0aea$1bh$1@news.nivel5.cl>