|
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
What's wrong with my <cfoutput group>?
I don't recall ever having a problem with the <cfoutput> group attribute. But I can't figure out why it isn't woring right here.Will Tomlinson 12/01/08 09:48 P I don't recall ever having a problem with the <cfoutput> group attribute. But I can't figure out why it isn't woring right here. My table looks like this: ID Date ZIP code --------------------------------- 1 12/01/2008 27403 2 12/01/2008 90210 3 12/01/2008 45789 4 12/01/2008 27403 5 12/02/2008 55555 6 12/02/2008 21454 A simple query: <cfquery name="getshipcalclog" datasource="#APPLICATION.settings.dsn#"> SELECT estshiplogid, estshiplogdate, estshippostalcode FROM tblestshiplog ORDER BY estshiplogdate DESC </cfquery> Now, I just want to output the records grouped by the date. So there should be a date heading, and all the zip codes with records on that date. <cfoutput query="getshipcalclog" group="estshiplogdate"> <h3>#estshiplogdate#</h3> <cfoutput> <p>#estshippostalcode#</p> </cfoutput> </cfoutput> But it outputs every occurence of 12/01/2008 and its zip. When it should display 12/01/2008 as a heading, then fours zips below it. Then start another heading 12/02/2008, and two zips below that. What am I doin wrong here? Thanks! Will Crap, it goes back to my stupid date/time datatype for the field. All the times are different, and CF IS group the data, but they're all different so it output each row. I used Michael's example from my other thread to do this. Seems to work: SELECT estshiplogid,CAST(FLOOR(CAST(estshiplogdate AS float)) AS datetime) AS theDate, estshippostalcode FROM tblestshiplog ORDER BY estshiplogdate DESC Then I just group using theDate. Thanks, Will
|
Mailing Lists
|
Latest Fusion Authority Articles
|
||||||