MySQL - List results from 2 tables

1

I have two tables with the same field and I need to make a SELECT with two conditions, I am trying this code but it is listing only the result of the first table ( entrada ), not the second table ( saida ):

SELECT * FROM entrada, saida WHERE entrada.idUsuario = '1' OR saida.idUsuario = '1';
    
asked by anonymous 09.02.2017 / 02:19

1 answer

1

I was able to use UNION :

(SELECT * FROM entrada WHERE idUsuario LIKE '1')
UNION 
(SELECT * FROM saida WHERE idUsuario LIKE '1')
    
09.02.2017 / 02:34