I'm trying to run a query on a table to see how many unique users have a usage record in the system at a given point. I've been working with the following query, but I've yet to see a proper result.
SELECT count(distinct usageUser), divisionName FROM records R INNER JOIN locate L ON L.computerID=R.usageComputerID WHERE R.usageWhen LIKE "2012-07-08T12:%" GROUP BY L.divisionName;
Currently the query returns 18, for each division in the joined table. Without the
GROUP BY clause I get the same number of records.
EDIT: I ran the query again, with suggestions from a comment. By removing the group by and count clause, I get this this (too big to post). This data is very poorly formatted, unfortunately it's inherited and fairly large.
It is not possible for these users to have used every lab like it's listed.
This was originally posted to server fault, and was migrated to StackOverFlow. I was then pointed to here saying this might actually be the most appropriate place for it.