Multiple SELECT with PHP/MYSQL

I have probably an easy question which keeps my mind bugging for some days now…
I’m trying to put the following SELECT statements into 1 multi SELECT statement, PHP/MYSQL.

SELECT * FROM myTable1
SELECT * FROM myTable2
SELECT * FROM myTable3 ORDER BY RAND() LIMIT 1
SELECT row1, row2 FROM myTable4 ORDER BY id DESC LIMIT 4

I tried UNION or UNION ALL but that doesn’t work because all MYSQL tables are different in row quantity.

use four separate queries

Then I guess it’s not possible.

Edit: like he says ^^

Sometimes the mind wants it too complicated while the answer is obvious.
Thanks for keeping my life simple! :wink:

As previous replies … unless tables 1 and 2 share a common value in one or more fields which allows you to JOIN them.

or have similar columns which allows you to UNION them

:slight_smile:

Which brings us to another reason why “SELECT *” can be bad. It tells us nothing about your db structure OP, so there’s not much in the way of suggestions we can make. Also, from each table, if you are building a combo box, you are only going to need 2 values anyway, so why pull all?

where did the 2-value combo box idea come from?

Reading too fast thinking he’s talking about <SELECT> tags.