[thelist] help w/design of SQL query

Tom Dell'Aringa pixelmech at yahoo.com
Fri Nov 15 09:42:01 CST 2002


--- rudy <r937 at interlog.com> wrote:

> > So wouldn't I have to get the categories first?
> > Then run a query on each category?
>
> AAACK!!  no
>
> if you ever find yourself calling the database repetitively from
> inside a
> loop, chances are really good that there's a much easier way, to
> say
> nothing of more efficient
>
> what you want to do is sequence your results by category, and
> within
> category by item
>
>      order by category, item
>
> then, when you are processing the result set, you have to detect a
> category
> "break" from one row to the next, and do the "new category" logic,
> which in your case means printing out the category name
>
> make sense?

Yep it makes sense, I just can't get my brain to translate it to sql
and then php! Looks like I have to hit the books on SQL again, its
been too long..thanks.

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com



More information about the thelist mailing list