显示包含来自另一个查询中的表的多行的下拉列表

IMG

I want to display AGREEMENT DISTRIBUTOR select field for each MANUFACTURER ITEM. AGREEMENT DISTRIBUTOR should only contain distributors assigned to the customer. Each customer has agreements. In the image above, we have an agreement with an id/GroupID of 1 for a customer with the id of 43.

 agreement table
 id    GroupID
 1     1
 2     2

distribgroup table
id    groupid    custid
1     1          43

Distributors are assigned to customers as per the "cust2distrib" table

       cust2distrib table

id    custid    distribid
1       43          11
2       43          10
3       43          9
4       41          11

 distributors table

id        name    
9        California    
10       Lincoln       
11       Atlanta      

Code used to grab correct distributors (there are multiple distributors. We only want to see the distributors that are assigned to a customer (see "cust2distrib" table above):

SELECT *, b.id as id, e.name2 as distribname, e.id as distribid, c.groupid as groupID     from agreement b
LEFT JOIN distribgroup c
ON c.groupid = b.GroupID
LEFT JOIN cust2distrib d
ON d.custid = c.custid
LEFT JOIN distributors e
ON e.id = d.distribid
WHERE c.groupid = $id

In the image above, we also display the agreement items (item number, type, discount...etc)...

agreement_items
id    groupID    item_number    item_description    din    type      discount 
1        1        111                Oranges        5                  2
2        1        222                Bananas        3     Delivered    5

...via this php code:

<?php
$sql = "SELECT * from agreement_items WHERE GroupID = $id";
try 
    { 

        $stmt = $db->prepare($sql); 
        $stmt->execute(); 
    } 
    catch(PDOException $ex) 
    { 

        die("Failed to run query: " . $ex->getMessage()); 
    } 


    $rows = $stmt->fetchAll(); 


//Check each record from your query
foreach($rows as $row) { 

?>
HTML displaying manufacturer item, distributor item number, type, discount,
ceiling price goes here.

**I ALSO NEED "AGREEMENT DISTRIBUTOR" TO BE PLACED HERE FOR EACH ITEM. 
Agreement Distributor needs to be a select input with the option to choose
between all distributors assigned to the customer of which the agreement belongs to**
<?
}

SO...if California, Lincoln, Atlanta are assigned to customer 43 and I am viewing agreement 1 which belongs to customer 43, I want to display California, Lincoln, Atlanta in the "AGREEMENT DISTRIBUTOR" dropdown FOR EACH manufacturer item (found in agreement_items table)

Any help would be MUCH appreciated. Thanks!