0
$catalog = $dbh->prepare("SELECT * FROM catalogo WHERE ativo = 2 ORDER BY catalogo_view DESC LIMIT 0,5");
$catalog->execute();
I want to search between two tables, as I do?
0
$catalog = $dbh->prepare("SELECT * FROM catalogo WHERE ativo = 2 ORDER BY catalogo_view DESC LIMIT 0,5");
$catalog->execute();
I want to search between two tables, as I do?
0
Try using UNION, but remember that in UNION the columns of the query have to have the same amount.
SELECT cliente_codigo, cliente_nome FROM cliente
UNION SELECT funcionario_codigo, funcionario_nome FROM funcionario
WHERE ativo = 2
Browser other questions tagged php mysql pdo
You are not signed in. Login or sign up in order to post.
JOIN? there is correspondence between the tables?
– rray
The two tables are interconnected?
– WeezHard
If the tables have a common reference, you can use Join.
Select * from tabela1 join tabela 2
on tabela1.campo = tabela2.campo
– Daniel Saraiva