Re: grouping query results - Mailing list pgsql-php

From Mitch Pirtle
Subject Re: grouping query results
Date
Msg-id 330532b605022810144884dd42@mail.gmail.com
Whole thread Raw
In response to grouping query results  ("Joolz" <joolz@arbodienst-limburg.nl>)
List pgsql-php
On Mon, 28 Feb 2005 10:48:23 +0100 (CET), Joolz
<joolz@arbodienst-limburg.nl> wrote:
>
> I have the feeling that this is a very common question, how do you
> people handle it? I looked at a lot of script sites, but no luck.

What I do is run a single query for all employees, then iterate over
the array in PHP for the counts.

The alternative of running several queries seems a bit heavy-handed to
me, but that is because I am always trying to make life easier for the
database server :-)

Note that many database libraries (PEAR::DB, ADOdb) also have
capabilities of returning counts of recordsets, so with two queries
you would be done. But I still like the first approach, as it is not
tied to the database or require external libraries to support.

-- Mitch

pgsql-php by date:

Previous
From: Andrew McMillan
Date:
Subject: Re: grouping query results
Next
From: Bruno Wolff III
Date:
Subject: Re: grouping query results