MySQL Forums
Forum List  »  Spanish

Re: Consulta Multitabla
Posted by: Jesús Uzcanga
Date: March 29, 2015 10:21PM

Jorge.

Quizás la solución es la función GROUP_CONCAT() de Mysql.

Quedaría algo más o menos así.

SELECT tabla1.id,tabla1.descripcion,GROUP_CONCAT(DISTINCT tabla2.ean SEPARATOR ', ') FROM tabla1
INNER JOIN tabla2 ON tabla1.id=tabla2.id

Esto te dará todos los ean al tado de los campos de id y descripción pero no te dará cada ean en un campo separado.

NOTA: El DISTINCT es opcional y es solo para que no repita valores. Si te interesa mostrar los repetidos solo elimina la palabra DISTINCT y ya.

Prueba a ver y nos comentas.

___________________________
Ing. Jesús Alfredo Uzcanga
Twitter: @JesusUzcanga

We learn the 20% of what we HEAR,
the 50% of what we SEE,
the 80% of what we DO and
the 95% of what we TEACH.

____________________________________________________________
https://www.linkedin.com/in/jauzcanga/

Options: ReplyQuote


Subject
Views
Written By
Posted
1960
March 29, 2015 02:36PM
Re: Consulta Multitabla
829
March 29, 2015 10:21PM
949
March 30, 2015 09:00AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.