JOINING TABLES
Posted: Mon Oct 14, 2002 11:07 pm
I am trying to draw data from three tables to create a report using mySQL and PHP.
Here are my tables and the pertinent fields:
PRODUCTS
fields: PRODUCT_ID, TITLE, COST, VENDOR_ID
VENDORS
fields: VENDOR_ID, VENDOR_NAME
ORDERS
fields: PO_NUM, VENDOR_ID, PRODUCT_ID, QTY_ORDERED
There may be several records in the Orders table with the same PO_NUM. I have been able to generate a list of all PO_NUMs with each number linking to a page which should display the detail of the PO.
Unfortunately, I can't get the detail to show up.
I want to display the PO_NUM, the VENDOR_NAME, the PRODUCT_ID, PRODUCT_NAME, QTY_ORDERED, COST, and then an extended price field which is the result of QTY_ORDERED * COST.
Any suggestions how this could be accomplished? I'm stumped.
Here are my tables and the pertinent fields:
PRODUCTS
fields: PRODUCT_ID, TITLE, COST, VENDOR_ID
VENDORS
fields: VENDOR_ID, VENDOR_NAME
ORDERS
fields: PO_NUM, VENDOR_ID, PRODUCT_ID, QTY_ORDERED
There may be several records in the Orders table with the same PO_NUM. I have been able to generate a list of all PO_NUMs with each number linking to a page which should display the detail of the PO.
Unfortunately, I can't get the detail to show up.
I want to display the PO_NUM, the VENDOR_NAME, the PRODUCT_ID, PRODUCT_NAME, QTY_ORDERED, COST, and then an extended price field which is the result of QTY_ORDERED * COST.
Any suggestions how this could be accomplished? I'm stumped.