bazz
02-11-2008, 02:19 AM
Hi,
I am querying two tables based on set criteria. If there is a match, I think I need to do a sub query to get the full details.
I need to get all the matched field values for address from tbl_address if there is a match.
my $sth = $dbh->prepare ("SELECT BD.business_id, BD.business_address_id, BD.group_name, ADDR.address_id, ADDR.city_or_county_name
FROM tbl_businessDetails BD, tbl_address ADDR
WHERE BD.group_name = '$selected_group_name'
AND BD.business_address_id = ADDR.address_id
AND BD.premises_name = '$selected_premises_name'
AND BD.business_name = '$selected_business_name'
") or die "prepare statement failed: $DBO::errstr\n";
What I need to do is: if there is a match, I need to call in the data from the tbl_address. Please can you give me a pointer.
bazz
I am querying two tables based on set criteria. If there is a match, I think I need to do a sub query to get the full details.
I need to get all the matched field values for address from tbl_address if there is a match.
my $sth = $dbh->prepare ("SELECT BD.business_id, BD.business_address_id, BD.group_name, ADDR.address_id, ADDR.city_or_county_name
FROM tbl_businessDetails BD, tbl_address ADDR
WHERE BD.group_name = '$selected_group_name'
AND BD.business_address_id = ADDR.address_id
AND BD.premises_name = '$selected_premises_name'
AND BD.business_name = '$selected_business_name'
") or die "prepare statement failed: $DBO::errstr\n";
What I need to do is: if there is a match, I need to call in the data from the tbl_address. Please can you give me a pointer.
bazz