Re: Thinking out loud - a continuation...
| From: | Robert Cummings | Date: | Thu, 22 Mar 2012 19:08:36 +0000 |
| Subject: | Re: Thinking out loud - a continuation... | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317189@lists.php.net to get a copy of this message | ||
On 12-03-22 01:06 PM, Jay Blanchard wrote:
On 3/22/2012 11:40 AM, Robert Cummings wrote:Rest might do you well on a number of levels :)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?[/snip] I must confess that the raging sinus headache and my general confusion makes this really unclear for me today. Maybe I should just set it aside for a day or so. I am super dense today.
For each level I am selecting for each parent in the level above. Let's say that level 2 contains 8 people. Level 3 contains 14 people. Only some of the 14 belong to the 8 and must be associated properly. So how can I, with one query, associate level 3' 8th, 9th and 10th people with level 2's 6th person keeping in mind that the 9th person might also belong to level 2's 4th person.At one point you indicated all the data was coming from one table. Can you send me the table fields and indicate which fields are used to determine parent child relationship? Also 2 sample rows of data which have a relationship would be helpful.
Just link up the sub-data? Place this array into a child array of the parent array? Again I apologize - maybe I should push away and let the customer know that it'll be a couple of more days.Yeah... child array... 'children' :) 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.