So I have multiple tables with identical layouts. They are full of statistics about users' activity in different locations. Each table is for a different location. This makes it very easy to show statistics for a particular location (table) but very difficult to show a user's statistics across tables. My old way of doing it was as follows:
For each table listed in SHOW TABLES:
select the data from that table where the user's ID is XYZ
print the data
The problem is that I can't sort the data. In other words, I can't have it order the data by the most "active" locations to the least active locations.
Another issue I am having with these tables is as follows: I would like to get the sum of each column in each table (since they're all ints) to give me a single row of sums. Then I would like to be able to sort the sum rows of each of those tables by the values of certain columns (like the problem above).
Can anyone help me with these two problems? If you need clarification or table structures I can post them.