Answered
complicated output grouping
I have some data in an Access DB and want to group the output
by year and by store name. However, the date in the DB is mm/dd/yy.
Here is my current query code:
<CFQUERY name="getinfo" datasource="#DSN#">
SELECT a.City, a.InstallDate, a.SQFT, Year(a.Installdate) as year,B.State,C.StoreName
FROM Installations a, States b, Stores c
WHERE b.ID=#URL.id# AND a.State= b.ID AND a.Store=c.ID
ORDER BY a.Installdate DESC, c.StoreName
</CFQUERY>
I want to ORDER BY year; not InstallDate but I keep getting an error message when I ORDER BY year.
If I ORDER BY a.InstallDate, I do not get an error message. However, in my CFOUTPUT statement I do not get the results I want. I want all of Store A for 2005 together not split apart as shown below
2005 - Store A Install Date SQFT
Thornton, Colorado 10/03/05 25197
2005 - Store B Install Date SQFT
Smokey Hill, Colorado 09/13/05
2005 - Store A Install Date SQFT
Aurora, Colorado 08/15/05 38281
Pueblo, Colorado 03/07/05 22920
Greely, Colorado 02/07/05 27998
Any suggestions are appreciated.
Here is my current query code:
<CFQUERY name="getinfo" datasource="#DSN#">
SELECT a.City, a.InstallDate, a.SQFT, Year(a.Installdate) as year,B.State,C.StoreName
FROM Installations a, States b, Stores c
WHERE b.ID=#URL.id# AND a.State= b.ID AND a.Store=c.ID
ORDER BY a.Installdate DESC, c.StoreName
</CFQUERY>
I want to ORDER BY year; not InstallDate but I keep getting an error message when I ORDER BY year.
If I ORDER BY a.InstallDate, I do not get an error message. However, in my CFOUTPUT statement I do not get the results I want. I want all of Store A for 2005 together not split apart as shown below
2005 - Store A Install Date SQFT
Thornton, Colorado 10/03/05 25197
2005 - Store B Install Date SQFT
Smokey Hill, Colorado 09/13/05
2005 - Store A Install Date SQFT
Aurora, Colorado 08/15/05 38281
Pueblo, Colorado 03/07/05 22920
Greely, Colorado 02/07/05 27998
Any suggestions are appreciated.