myatia
Programmer
- Nov 21, 2002
- 232
Hi, all,
Does anyone know how to write a query to make a count of counts? I am currently tracking how many people log into my website, and I would like to find out how many people log in how many times. In other words, I want to know the number of people that log in 1 time, the number that log in 2 times, the number that log in 3 times, etc. I then want to group this data up by month.
I've tried the following, but I'm given a "Syntax error" message (no other details are listed):
FYI, I'm using VFP 6.0. If anyone has any ideas, I'd really appreciate it.
Thanks,
Misty
Does anyone know how to write a query to make a count of counts? I am currently tracking how many people log into my website, and I would like to find out how many people log in how many times. In other words, I want to know the number of people that log in 1 time, the number that log in 2 times, the number that log in 3 times, etc. I then want to group this data up by month.
I've tried the following, but I'm given a "Syntax error" message (no other details are listed):
Code:
SELECT LoginMonth, LoginMonthName, LoginCount, COUNT(id) AS AggLoginCount ;
FROM ( SELECT month(logindate) AS LoginMonth, cmonth(logindate) AS LoginMonthName, id, COUNT(id) AS LoginCount ;
FROM logintrack ;
GROUP BY LoginMonth, id );
ORDER BY LoginMonth, LoginCount ;
GROUP BY LoginMonth, id
FYI, I'm using VFP 6.0. If anyone has any ideas, I'd really appreciate it.
Thanks,
Misty