Hi there
After posting a little bit earlier about many to many tables, I was
wondering how I can get the total number of logins for each store, if I'm
storing information like so:
Stores:
+---------+-------------+
| StoreID | StoreName |
+---------+-------------+
| 6 | Barrie |
| 10000 | Toronto |
| 1 | Head Office |
+---------+-------------+
Users:
+--------+---------+-----------------+
| UserID | StoreID | Name |
+--------+---------+-----------------+
| 1 | 1 | Administrator |
| 2 | 6 | Chris Bosh |
| 3 | 6 | Reginald Dwight |
| 4 | 10000 | Bart Simpson |
+--------+---------+-----------------+
LoginTimes:
+--------+------------+
| UserID | LoginTime |
+--------+------------+
| 2 | 1130348594 |
| 2 | 1130349580 |
| 2 | 1130365537 |
| 2 | 1130528264 |
| 2 | 1130720304 |
| 2 | 1130791108 |
| 3 | 1130790764 |
| 3 | 1130791297 |
| 3 | 1130791322 |
| 4 | 1130794187 |
+--------+------------+
so, im looking for something like "Barrie: 9 total logins, Toronto: 1
total logins, Head Office: 0 total logins"
This is taking place on a 4.0.x server, so subqueries are not permitted.
I'm assuming this is possible to do in one select statement, but i start
to get lost when i make a query from more than two tables....
Thanks kindly.