bazz
02-12-2008, 09:25 PM
The query below brings in a record for one row of the tbl_businessDetails but is repeated once, for every row in tbl_contact.
So I get the first three values correctly for the business but, they are repeated alongside the values for each individual record in tbl_contact.
my $sth = $dbh->prepare ("SELECT BD.contact_id, BD.group_name, BD.premises_name, CNT.Contact_ID, CNT.Phone_Number, CNT.Fax_Number, CNT.Web_URL, CNT.email_Address
FROM tbl_businessDetails BD, tbl_contact CNT
WHERE BD.group_name = '$selected_group_name'
AND BD.premises_name = '$selected_premises_name'
") or die "prepare statement failed: $DBO::errstr\n";
The WHERE conditions are met correctly, and they are for the single business entry in tbl_businessDetails.
Please tell me what I am not understanding.
Yup, it's me who is simple !! lol. I added a new AND conditioanl, to force BD.contact_id = CNT.Contact_ID It works now.
bazz
So I get the first three values correctly for the business but, they are repeated alongside the values for each individual record in tbl_contact.
my $sth = $dbh->prepare ("SELECT BD.contact_id, BD.group_name, BD.premises_name, CNT.Contact_ID, CNT.Phone_Number, CNT.Fax_Number, CNT.Web_URL, CNT.email_Address
FROM tbl_businessDetails BD, tbl_contact CNT
WHERE BD.group_name = '$selected_group_name'
AND BD.premises_name = '$selected_premises_name'
") or die "prepare statement failed: $DBO::errstr\n";
The WHERE conditions are met correctly, and they are for the single business entry in tbl_businessDetails.
Please tell me what I am not understanding.
Yup, it's me who is simple !! lol. I added a new AND conditioanl, to force BD.contact_id = CNT.Contact_ID It works now.
bazz