I have 5 tables. One primary and 4 additional (they have different columns).
If objects
is a parent table it means that objects
.ID
is a unique object. Right? All other items (mobiles, tablets, computers) are child ones for object and mobile and tablet cannot have the same ID. If so, it is enough to use this simple query -
SELECT * FROM objects o
LEFT JOIN obj_mobiles m
ON o.id = m.ID
LEFT JOIN obj_tablets t
ON o.id = t.ID
LEFT JOIN obj_computers c
ON o.id = c.ID
Add WHERE clause to filter types, e.g.: WHERE o.type = 'mobile'.