Don Huff <[EMAIL PROTECTED]> wrote on 03/01/2005 02:33:34 PM:

> Hi,
> 
>     I am wanting to write a nesting of queries without having to 
> retrieve all the records of the first query (because of the volume).
> 
>     <pseudo code, using MySQL 5. alpha/PHP mysqli C connector>
> 
>     res1 = query(db, sql1, USE_DATA);
>     while (row1 = fetch_row(res1))
>     { res2 = query(db, sql2_function_of(row1);
>        row2 = fetch_row(res2, USE_DATA);
>        free_result(res2); }
>     free_result(res1);
> 
>     From my reading this seem to violate two principal I have used 
elsewhere
>     1) query 1 is still busy, so I can't begin a query 2 -- can I open a 

> new connection to get around this?
>     2) I didn't read all the results of query 2, so they may show up 
> somewhere I don't want them?
> 
>     Is there a way to do this, does it work and I am missing something?
> 
> Thanks,
> Don.
> 

The parent-child type of query you want to make is generally accomplished 
through a JOIN. However, you say you have more data than you want to deal 
with at one time. Can you be more specific? What is the actual problem you 
are trying to solve? The more details you can give, the better the 
combined response will be.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to