Re: Thinking out loud - a continuation...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12-03-22 12:34 PM, Jay Blanchard wrote:
[snip]
Sorry, I just realized I didn't make the optimization explicitly
obvious... when I say "Select the children" I mean to select them
using an IN( id1, id2, id3 ) clause instead of a query for each. This
is why we build the array of parent IDs (also I wrote build an array
of "child IDs", it should have read "parent IDs" and has been fixed
above :).
[/snip]

SELECT DISTINCT children FROM table WHERE column1 IN(id1, id2, id3....) ?

I am sure I am not following you now. Maybe I didn't explain clearly?

What's the field for which you are selecting data? I've written this up as a parent/child relationship but it works for data/sub-data relationships also.

SELECT itemId, otherData FROM table WHERE "some condition";

SELECT itemId, subData FROM otherTable WHERE itemId IN (id1, id2, ...);

Then just link up the sub-data to the primary data in a loop and finally generate your JSON.

Does that clarify?

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux