query: (SELECT x.uniqueId, 'resId' as tablekey, x.resId as id, x.title, x.address, x.city, x.state FROM residential x, res_interior y WHERE y.parentId=x.resId AND uId='' GROUP BY uniqueId) UNION DISTINCT (SELECT x.uniqueId, 'commId' as tablekey, x.commId as id, x.title, x.address, x.city, x.state FROM commercial x, comm_interior y WHERE y.parentId=x.commId AND uId='' GROUP BY uniqueId) ORDER BY RAND() limit 1 order by RAND() limit 5
id:Resource id #18

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by RAND() limit 5' at line 11