I have several databases that all have the same structure (same tables, same fields of each table).
| sword_0 |
| sword_1 |
| sword_2 |
| sword_3 |
| sword_4 |
| sword_5 |
| sword_6 |
| sword_7 |
| sword_8 |
| sword_9 |
+-------------------+
| Tables_in_sword_5 |
+-------------------+
| t_attr |
| t_basics |
| t_data |
| t_equip |
| t_friend |
| t_mail |
| t_resources |
| t_union |
| t_union_member |
+-------------------+
What I need to do is (I do use sword_5; first, then):
select tba.rid from (
select rid from t_basics where online_time <= (create_time + 259200)
) as tba
inner join
(select * from t_attr where type = 1000002 and heroLv >= 300) as tbb
on tba.rid = tbb.rid;
So the problem is that I don't want to switch between each database (use sword_0; use sword_1;....) and paste the same query and then copy all the query results manually.
Is there a way I can loop all the databases and get all results for once? (rid is unique among all those sword_* databases).