See if this technique applies in your situation:
(
( SELECT ...
ORDER BY ... LIMIT 10 )
UNION
( SELECT ...
ORDER BY ... LIMIT 10 )
) ORDER BY ... LIMIT 10
That is, get the LIMIT from each part of the UNION, but pessimistically assume each select providing the desired 10 rows. Then blend the 20 rows together and pick the real 10 you desired.
If you are doing this for "pagination" (and I can rant against 'pagination via LIMIT'), then it gets more complicated for subsequent pages. Page 3, for example:
(
( SELECT ...
ORDER BY ... LIMIT 30 ) -- yes, all 30
UNION
( SELECT ...
ORDER BY ... LIMIT 30 )
) ORDER BY ... LIMIT 20,10 -- skip 20, then deliver the 3rd page's worth
By the time you are at the last page, it is terribly slow.
As for the syntax error -- please show me. If it says
... near 'xxxx'
the xxxx pinpoints where the problem is. If it says
... near ''
then the problem is at the end of the statement.