🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #1472

problema join con mysql

#1472
From: Rickoj
Date: Fri, 04 Aug 2006 20:23
26 lines
1913 bytes
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: <eb0aea$1bh$1@news.nivel5.cl>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!meganewsservers.com!feeder2.on.meganewsservers.com!nntp-server.pubsub.com!news.nivel5.cl!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,599d380b0a5f3acc,start
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!meganewsservers.com!feeder2.on.meganewsservers.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: problema join con mysql
Date: Fri, 4 Aug 2006 16:23:29 -0400
Organization: Varios
Lines: 29
Message-ID: <eb0aea$1bh$1@news.nivel5.cl>
NNTP-Posting-Host: pc-211-201-120-200.cm.vtr.net
X-Trace: news.nivel5.cl 1154723082 1393 200.120.201.211 (4 Aug 2006 20:24:42 GMT)
X-Complaints-To: news@news.nivel5.cl
NNTP-Posting-Date: Fri, 4 Aug 2006 20:24:42 +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; Original