I have a table that looks like this:
TABLE1:
id, username, timestamp
1, test1, 123123123
2, test2, 123123124
3, test3, 123123125
4, test4, 123123126
1, test1, 123123127
1, test1, 123123128
3, test3, 123123129
There are thousands of entries in that table. I'm producing a top 10 list of entries based on row count and date range using this:
select id, COUNT(id) AS total_count from TABLE1 where timestamp >= '$startTime' and timestamp <= '$endTime' GROUP BY id ORDER BY total_count DESC LIMIT 10
startTime and endTime is defined and the above query works exactly how I want it to. Now I want to add another table into the mix.
TABLE2:
id, username, timestamp
1, test1, 123123123
2, test2, 123123124
3, test3, 123123125
4, test4, 123123126
How can I include TABLE2 into the query so the totals come from both tables and are combined?