Jump to content

Help with combining 2 mysql queries ...


pepelepew1962

Recommended Posts

Hello, I am trying to combine 2 queries together and am now looking for help.  I really do not know how to explain this, but what I need is the 2 queries to be combine and then the information made available.  The key that holds this together is Load00 and Kids00.  This is a many ( tblKids ) to one ( tblLoad ) and I fully accept that information from the second query is duplicated, that is actually how I need it.  Can anyone place these 2 together.

 

 

        //  Part 01
        $rad2101 = "SELECT tblLoad_Load00, tblLoad_Load19, tblLoad_Load20, tblLoad_Load21, tblKids_Kids00, tblKids_Kids11, tblKids_Kids12, tblKids_Kids13, tblKids_Kids15 FROM tblLoad_Load AS tblLoad_Load JOIN tblKids_Kids AS tblKids_Kids ON (tblLoad_Load00 = tblKids_Kids00)";
//
        //  Part 02
        $rad2102 = "SELECT tblKids_Kids00, MIN(tblKids_Kids12) AS MIN02, MAX(tblKids_Kids12) AS MAX02, AVG(tblKids_Kids12) AS AVG02 FROM tblKids_Kids GROUP BY tblKids_Kids00";
//
        //  Part 03
        $rad2103 = "???";
//

    while($row = mysql_fetch_array($rad2103))
    {
//
//
        $Load00 = $row['tblLoad_Load00'];  //  Load ID
        $Load19 = $row['tblLoad_Load19'];
        $Load20 = $row['tblLoad_Load20'];
        $Load21 = $row['tblLoad_Load21'];
        $Kids00 = $row['tblKids_Kids00'];  //  Kids ID
        $Kids11 = $row['tblKids_Kids11'];
        $Kmax02 = $row['MAX(tblKids_Kids12'];
//
//

 

MOD EDIT: code tags added.

Link to comment
https://forums.phpfreaks.com/topic/238054-help-with-combining-2-mysql-queries/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.