0

I have a sql query where I union 10 countries with group by in selects. Selects differ only with country. Query fails on temp space, probably because there is too many group by space required.

Therefore I would like to use some cycle, with countries in array as a variable in the query.

I tried to use this solution How to cycle with an array in MySQL? but when I set element as a source with from, mySQL considers it as a table name, not variable and returns schema.element doesn`t exists

For example, simplified, I need to do

select * from brazil.accounts
union
select * from venezuela.accounts etc

but cannot use union, so trying to use a cycle.

Thanks

bennes
  • 61
  • 3
  • 10

0 Answers0