I'm trying to make a query for a cfchart... here's my code
SELECT convert(varchar(10),Date,101) AS enroll_date, COUNT(user_type) AS user_count
FROM IBS_apps
WHERE user_type = 'new user'
GROUP BY convert(varchar(10),Date,101)
ORDER BY convert(varchar(10),Date,101)
DB is SQL Server. What I'm trying to do is get a count of enrollments by date(some days might have more than one). I converted the date field to get a short date format (12/06/2004). This code works fine, except the order by doesn't work with data from more than one year. It's only sorting by day/month, not year. If I order by "date" I get an error because "date" is not in group by or aggregate clause...
Any ideas?
SELECT convert(varchar(10),Date,101) AS enroll_date, COUNT(user_type) AS user_count
FROM IBS_apps
WHERE user_type = 'new user'
GROUP BY convert(varchar(10),Date,101)
ORDER BY convert(varchar(10),Date,101)
DB is SQL Server. What I'm trying to do is get a count of enrollments by date(some days might have more than one). I converted the date field to get a short date format (12/06/2004). This code works fine, except the order by doesn't work with data from more than one year. It's only sorting by day/month, not year. If I order by "date" I get an error because "date" is not in group by or aggregate clause...
Any ideas?