Page 1 of 1

Grouping output from a database

Posted: Thu Apr 24, 2003 7:09 pm
by john_crawford32
I have a site
http://www.motorcyclesinretrospect.com/ ... ontent=cal

with a calendar of events.
I need to group the items by location, my field is State
What I want for example if there were 2 records from Maine it would look like

Maine

Date1 Event


Date2 Event

Maryland

Date1 Event.

I am not sure how to do this I don't think Group By in the SQL Statement is the answer here but I am not sure.
Thanks
John

Posted: Thu Apr 24, 2003 7:38 pm
by volka
you might use ORDER BY
then store the last value of State, if this value changes a new section begins (then store the new "old" value).

Posted: Thu Apr 24, 2003 9:17 pm
by john_crawford32
OK, so I am overworked and my brain went on strike.
Thanks!

Posted: Thu Apr 24, 2003 9:19 pm
by airo
john_crawford32 wrote:OK, so I am overworked and my brain went on strike.
Thanks!
Heh, that happens to the best of us...

Posted: Fri Apr 25, 2003 7:23 am
by volka
perfectly normal condition ;)