I'm wondering if someone has a better solution then I've come up with. I've got a few reports that pull from various tables. Some times I'm not able to put all the tables into a single query/view. So I end up with a master query and 1 (or more) supporting queries. I'm using MSSQL 2000/IIS/PHP4/ADODB. This may be my own weakness in designing a query, I'm willing to learn if it is. So I've ended up doing things like: function formula($part,$array){ //imagine a formula to calculate weeks in pipe for a part foreach($array AS $val){ if($val[0]==$part){ $qty = $val[1]; } } return $qty; } $q1 = "SELECT part, fcast FROM parts"; $rs1 = $conn->Execute($s); $rs1_arr = $rs1->GetArray(); $q2 = "SELECT part, qty FROM pos"; $rs2 = $conn->Execute($s); $rs2_arr = $rs2->GetArray(); foreach($rs1_arr AS $data){ echo "Part: ".$data[0]; echo "Forecast: ".$data[1]; echo "POs: ".formula($data[0],$rs2_arr); } This is not a wonderful example, because I could LEFT JOIN pos to parts. But I have more complex queries that have several INNER/LEFT joins that once I bring in that last table to complete my query it (the last table) skews my sums. Really I'm just wondering if others have come across -- Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php