Re: MySQL + PHP question
| From: | André Medeiros | Date: | Tue, 26 Jul 2005 14:11:31 +0000 |
| Subject: | Re: MySQL + PHP question | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219351@lists.php.net to get a copy of this message | ||
On Tue, 2005-07-26 at 13:39 +0100, Mark Rees wrote:
> "André Medeiros" <andre.caum@gmail.com> wrote in message
> news:1122379553.3499.14.camel@vaio...
> > One thing I didn't quite explain myself well... I'm building this to
> > register objects on a permission system.
> >
> > The SQL weight is heavy as it is, and I want to save queries as much as
> > possible. Making two queries to extract information about a project and
> > it's parent is not something I'd want to do. I know recursiveness, but
> > thanks for the pointers and for the reply :)
> >
> > Best regards
>
> I must admit I still don't really get what you are looking for. Does this
> query help?
>
> select c.field1 AS childfield1,
> c.field2 AS childfield2,
> (etc)
> p.field1 AS parentfield1,
> p.field2 AS parentfield2,
> (etc)
> FROM
> child AS c
> LEFT JOIN
> parent AS p
> ON c.parent=p.id
>
> ?
>
Yeah, that might do, thanks!