Re: Re: Sort with PHP or SQL?
| From: | Miguel Cruz | Date: | Sat, 06 Jul 2002 08:00:52 +0000 |
| Subject: | Re: Re: Sort with PHP or SQL? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-105841@lists.php.net to get a copy of this message | ||
On Sat, 6 Jul 2002, Patrick Teague wrote:
> $query = "SELECT * " .
> "FROM Headers LEFT JOIN Pages ON (Headers.Header_ID=Pages.Header_ID) " .
> "ORDER BY HeaderOrder DESC, Header, PageOrder DESC, PageTitle;";
>
> Any ideas on optimizing this? DB stuff doesn't come near the top of things
> I'm good at :) The other problem is that any pages that end up having no
> Header "disappear", which is a good thing on the menu, but a bad thing on
> the admin pages when you're trying to connect all of them.
SELECT from pages and use LEFT OUTER JOIN if you want to include pages
with no header.
miguel