"Ashley M. Kirchner" <[EMAIL PROTECTED]> wrote:
> If I list 15 to 30
> projects per page, that's 31 to 61 queries for one page: once to the
> projects table to get the projects, then for each project I make two
> queries, one to the history table and one to the comments table to get
> the accurate values (or to verify them).  This seems rather inefficient
> to me.

Use the LEFT JOIN syntax.  Read about it in the manual or search for
examples in the archives http://marc.theaimsgroup.com/?l=mysql&r=1&w=2.  A
left join gets all of the records from a parent table (projects) and the
matching records from joined tables (history, comments).  You can then get
everything you need in a single query.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to