pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: Molly Gibson <molly_gibson2002@yahoo.com>
Cc: pgsql-php@postgresql.org
Subject: Re: formatting output: grouping results with identical fields
Date: Fri, 9 May 2003 16:08:24 -0600 (MDT)
Message-ID: <Pine.LNX.4.33.0305091601570.14159-100000@css120.ihs.com> (raw)
In-Reply-To: <20030509220323.75714.qmail@web41811.mail.yahoo.com>

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.




view thread (4+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0305091601570.14159-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0305091601570.14159-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0305091601570.14159-100000@css120.ihs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: scott.marlowe@ihs.com, molly_gibson2002@yahoo.com
  Subject: Re: formatting output: grouping results with identical fields
  In-Reply-To: <Pine.LNX.4.33.0305091601570.14159-100000@css120.ihs.com>
  References: <20030509220323.75714.qmail@web41811.mail.yahoo.com> <Pine.LNX.4.33.0305091601570.14159-100000@css120.ihs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox