I have a page where I will have to make several queries to the bank. At present, they are a total of three tables. They are: cadastro
, publicacoes
and estilo
. Currently I do this:
SELECT nome, sobrenome, usuario, email FROM cadastro WHERE usuario = "$usuario" LIMIT 1;
SELECT conteudo, data, hora, usuario FROM publicacoes WHERE usuario = "$usuario" ORDER BY id LIMIT 5;
SELECT cor1, cor2, cor3, usuario FROM estilo WHERE usuario = "$usuario" LIMIT 1;
All queries are made and then I manipulate each query
through foreach...
.
My question is: Is there any way to merge all of these querys into a single query, thus leaving the code cleaner and more performative?