All,

I have a table that contains several items and most of these items are assigned 
a month and the current year using #CreateODBCDateTime(CreateDate(Year( Now() 
), form.month_assigned, Day( Now() )))# 
in my insert or update sql statements. Some items will not be assigned a date.

recw_assign_month: contains all the date values for each item.
<cfquery name="rsContestwinners" datasource="#datasource#">
SELECT DISTINCT recw_assign_month
FROM         dbo.tbl_recipe_monthly_winner
WHERE     (recw_assign_month <> '')
GROUP BY recw_assign_month
ORDER BY YEAR(recw_assign_month), MONTH(recw_assign_month)
</cfquery>

ERROR I get: ORDER BY items must appear in he select list if SELECT DISTINCT is 
SPECIFIED.

QUESTION: How do I get this list to sort by year and then by month from newest 
to oldest date?

I want to query all the items that have been assigned a data value and create a 
distinct list of the months and the year that have been assigned.  Regardless 
of the number of items assigned to a particular month, 
the list would look ...

October 2005
November 2005
December 2005
January 2006
February 200
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007 ... etc.

Thank you.

D

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262067
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to