Hi there everyone,

 

I'm new to JOINS and have followed some info in the MySQL manual but I'm at
a loss, using the code I'll paste below, I get each result 4 times and I am
confused as to why?  Basically I'm trying to display ALL fields from the
vendorprices table, and grab just the Description column from the fooditems
table, the factor which joins them both is the string $VendorID which in the
vendorprices table is VendorNumber and in the fooditems table is
CategoryNumber.

 

$sql = "SELECT * FROM vendorprices LEFT JOIN fooditems on
(vendorprices.VendorNumber = fooditems.CategoryNumber AND
fooditems.CategoryNumber = '$VendorID') WHERE
vendorprices.VendorNumber='$VendorID' AND
fooditems.CategoryNumber='$VendorID'";

 

Can anyone see where I'm going wrong?  This is driving me nuts and I need to
figure it out urgently.

 

Thank you for your help.


Regards

 

Chris

Reply via email to