I have 3 tables, with 3 fields all the same. I basically want to select information from each table
For example:
userid = 1
I want
with 3 fields all the same
So you mean that you want the same 3 fields
from all 3 tables?
SELECT r.col1, r.col2, r.col3
FROM random r
WHERE r.userid = '1'
LIMIT 0, 30
UNION ALL
SELECT p.pcol1, p.pcol_2, p.p3
FROM pandom p
WHERE p.userid = '1'
LIMIT 0, 30
UNION ALL
SELECT l.l1, l.l2, l.l3
FROM landom l
WHERE l.userid = '1'
LIMIT 0, 30
The fields don't have to be named the same, but the same types need to line up in position 1, 2 and 3.
The way the limits work is:
random
.random
, it will try to fill up to 30 from pandom
and only finally landom