Joining tables with the same name and schema from multiple databases in MySQL

So we have 23 databases with the same schema and table names. I need to fetch all the data from a table called inventory which is present in all the dbs.
The possible solution I can think of is doing a UNION ALL, but that means I’ll have to do a union 22 times.
Is there a shorter, easier faster way this can be done?

@Raddit 11 hr. ago

https://www.reddit.com/r/SQL/comments/x0nf96/joining_tables_with_the_same_name_and_schema_from/?utm_source=share&utm_medium=ios_app&utm_name=iossmf