[thelist] Need help with difficult MySQL query

John Handelaar genghis at members.evolt.org
Fri Jul 12 18:58:01 CDT 2002


> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Simon Willison
> Sent: 13 July 2002 00:48
> To: thelist at lists.evolt.org
> Subject: [thelist] Need help with difficult MySQL query
>
> This only returns one row per entry, but in doing so only returns
> information on one category pre entry which is no good as some
> entries have
> more than one category.
>
> Is what I'm trying to do even possible?

I'm sure that someone more guru-like with MySQL may
be able to provide something *exactly* like what you're
after but in the meantime...

This could be two queries.  The first gets the last
X entries.

Next, run a foreach() loop along the result set of
query 1, and get the category information there, which
would return an array containing all the categories
attached to the single unique entry being parsed.

It does mean effectively running 21 short queries, but
hey - that's what mysql_pconnect() is for, right :-)

------------------------------------------
John Handelaar

T +44 20 8933 1494       M +44 7930 681789
F +44 870 169 7657   E john at userfrenzy.com
------------------------------------------
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.375 / Virus Database: 210 - Release Date: 10/07/2002




More information about the thelist mailing list