display a variable in mysql query Inner

0

I have a query of several tables and they have fields with the same name.

I would like to know if there is a way to show the value of one of those fields with the same name but selected from which of the tables.

I normally use $ row ["id"] but suppose that the field "id" exists in two tables that one with an INNER JOIN as it could show indistinctly the field "id" of articles and addresses?

the query would be this:

SELECT * FROM 'Articulos' art INNER JOIN 'Direcciones' ean ON art.id = ean.idcosa INNER JOIN 'Configuraciones' conf ON art.sexo = conf.id WHERE UPPER(CONCAT(art.nombre,art.temporada)) LIKE UPPER('%".$buski."%') OR ean.'3' = '".$buski."' OR ean.'4' LIKE UPPER('%".$buski."%') AND 'borrado' = 0 limit 0,20
    
asked by Killpe 17.05.2017 в 20:25
source

1 answer

1
SELECT art.id as idart, ean.id as idean,
    /*  las demas columnas que necesitas */ 
   FROM 'Articulos' art INNER JOIN 'Direcciones' ean 
     ON art.id = ean.idcosa 
                        INNER JOIN 'Configuraciones' conf 
    ON art.sexo = conf.id 
  WHERE UPPER(CONCAT(art.nombre,art.temporada)) LIKE UPPER('%".$buski."%') OR
        ean.'3' = '".$buski."' OR ean.'4' LIKE UPPER('%".$buski."%') AND 'borrado' = 0 limit 0,20
    
answered by 17.05.2017 / 23:28
source