UNION query in connector

hello,
I am trying to call a SQL query within my connector but it doesn’t accept it. he quesy is well formatted and works correctly in mysql but not within the connector. is there a solution for it please ?

I can’t create a view as I have some parameters to share with the query

Could you please, provide a complete demo where the problem can be reconstructed?