Re: How to fetch a "group by" Query?
| From: | David Robley | Date: | Wed, 11 Jul 2001 01:16:41 +0000 |
| Subject: | Re: How to fetch a "group by" Query? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57271@lists.php.net to get a copy of this message | ||
On Tue, 10 Jul 2001 22:10, Frédéric Mériot wrote:
> Hello (again)
>
> I've got a query which extract titles and categories with a group by on
> the categorie. Is there a simple way to display rows like this (without
> doing a second query ):
>
> Categorie A
> -titi
> -toto
> -tutu
>
> Categorie B
> -bibi
> -nini
> -fififi
>
> Categorie C
> -titi
> -toto
> -tutu
>
> ... etc
>
> With cold fusion (for those who know) I want to do the same as
> <CFOUTPUT QUERY="myquery" GROUP="categorie">
>
> Thanks
Select category, description from table where whatever order by category,
description
Then when you display the rows, keep track of the current and previous
value of $description; if it changes, print the new value.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Don't stop posting, a good laugh breaks up my day nicely