Re: formatting output: grouping results with identical fields
| От | scott.marlowe |
|---|---|
| Тема | Re: formatting output: grouping results with identical fields |
| Дата | |
| Msg-id | Pine.LNX.4.33.0305091601570.14159-100000@css120.ihs.com обсуждение исходный текст |
| Ответ на | formatting output: grouping results with identical fields (Molly Gibson <molly_gibson2002@yahoo.com>) |
| Ответы |
Re: formatting output: grouping results with identical fields
|
| Список | pgsql-php |
On Fri, 9 May 2003, Molly Gibson wrote:
> Hi list,
> Textile geek-grrl here--I recently created a postgres
> database to keep my fabric, pattern, & project
> inventory. (Do I win a prize for 'weirdest thing for
> which someone has used postgres'?)
I'm certain there's someone out there doing something stranger than this.
> This is great for my purposes, but I'd like to clean
> up the table a bit more and have the category only
> print once each time it occurs, and the manufacturer
> only print once in each category.
What you can do is something like (this is pseudo code) before you start
your while loop:
$current_category = <category from first row>
then in your while loop, check to see if it's changed:
if ($current_category != $new_category){
print $new_category;
$current_category = $new_category;
}
Get the idea? It works a charm for things like this.
В списке pgsql-php по дате отправления: