July 21, 2003 at 10:30 am
is it possible in a sql 2000 database
select query to group a time_date field
weekly or monthly
it is stored in the database by day ?
cheers
July 21, 2003 at 10:39 am
by using Datename() function u can group
in weekly or monthly
July 21, 2003 at 12:17 pm
SELECT MONTH(DateField) , YEAR(DateField), COUNT(*)
FROM MyTable
GROUP BY MONTH(DateField) , YEAR(DateField)
HAVING COUNT(*) > 0
July 22, 2003 at 6:31 am
Hi Jay,
Just being picky but why do have 'HAVING COUNT(*) > 0' in the query? Is it not superfluous as the query cannot return month/year with a count of 0?
Edited by - davidburrows on 07/22/2003 06:31:49 AM
Far away is close at hand in the images of elsewhere.
Anon.
July 22, 2003 at 6:45 am
quote:
Hi Jay,Just being picky but why do have 'HAVING COUNT(*) > 0' in the query? Is it not superfluous as the query cannot return month/year with a count of 0?
Edited by - davidburrows on 07/22/2003 06:31:49 AM
You're right David. An unfortunate COPY and PASTE error (I was copying a similar solution using a detail table and didn't remove the HAVING clause. Good spot!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply