fire-eyed-boy wrote:
Deanna Bonds-2 wrote:
I would use the join method. Calling out to the database is an
expensive operation, so I try to minimize the number of calls. Also,
try not to think in terms of loops when you consider data, it is more
based in set theory.
Set theory is what the Joins and Relational concepts of sql databases
were built around. It is the way they work naturally. Zend recently
posted a great conference talk from last year that goes into this a bit.
http://devzone.zend.com/content/audio/zendcon_sessions/zendcon_sessions_podcast_017.mp3
<http://devzone.zend.com/content/audio/zendcon_sessions/zendcon_sessions_podcast_017.mp3> is
the audio
http://www.slideshare.net/ZendCon/sql-query-tuning-the-legend-of-drunken-query-master-presentation
<http://www.slideshare.net/ZendCon/sql-query-tuning-the-legend-of-drunken-query-master-presentation> is
the slides that go with it.
If that doesn't explain it enough, might want to google sql set theory
or relational database set theory, and read up on it. A bit too big to
explain it all in an email post.