Incorrect usage of UNION and LIMIT

3

I want my query to return only the first record of the first table (if there is data in it), because the second table does not have repeated data.

But it returns me this error:

  

Error Code: 1221. Incorrect usage of UNION and LIMIT

My code:

SELECT administradores_id FROM adm LIMIT 1
UNION
SELECT usuarios_id FROM user;
    
asked by anonymous 22.11.2018 / 15:50

1 answer

3
(SELECT administradores_id FROM adm LIMIT 1)
UNION
SELECT usuarios_id FROM user;

There is an ambiguity that the parser can not solve on its own, you have to help with a less ambiguous syntax.

I have my doubts if this is a query that gives some useful result, but I do not know the details.

    
22.11.2018 / 15:55