From: | Mitch Pirtle <mitch(dot)pirtle(at)gmail(dot)com> |
---|---|
To: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: grouping query results |
Date: | 2005-02-28 18:14:38 |
Message-ID: | 330532b605022810144884dd42@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
On Mon, 28 Feb 2005 10:48:23 +0100 (CET), Joolz
<joolz(at)arbodienst-limburg(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2005-02-28 18:30:51 | Re: grouping query results |
Previous Message | Andrew McMillan | 2005-02-28 18:10:16 | Re: grouping query results |