Peter, Sorry, I didn't read you code fully! You are correct of course - good find!
Dave Crozier -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Cushing Sent: 26 June 2007 15:26 To: [email protected] Subject: Re: SQL "Group By" error?? Dave Crozier wrote: > Peter, > I want to force each entry to group as of the 1st of the month, hence the > Date(YY,MM,1) function, but obviously this doesn't work. I need to pass the > data into a graphing class which expects dates to be specified along the x > axis and want to group monthly totals together. > > However the work around is certainly not obvious if you want to do it as > cleanly as possible (i.e one single SQL statement) Hi Dave, This does work as tested it. select test.date-DAY(test.date)+1 as Sort_Key....... > Also as a slight deviation, Ted suggested that the "Select all" is > inappropriate and I'd ask why please? I certainly have always used it within > joins to no adverse effect and can't see why this is wrong - Ted, please > elucidate ??? I thought that you either used distinct or all as they are > obviously mutually exclusive regardless of the group by clause. > As far as I can see (from the help file etc) the ALL is ignored in all circumstances except when doing a UNION, in which case it will not remove the dupes from the resulting set of data. For normal queries (detailed reports) ALL is the default, and DISTINCT will remove duplicate rows. As you were not using a UNION it makes no difference AFAIK. Peter [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

