pdc124
February 13th, 2010, 06:47 AM
ive got a database of a couple of tables eg
members
name, interests, loc_ref
and location
loc_index, address, area
I want to extract all names for a given location that belongs to the member im searching for
eg
SELECT members.name, members.interests, members.loc_ref, location.address, location.area
FROM members,location
WHERE members.loc_ref = location.loc_index
AND members.name LIKE 'smith'
gets the individual record
but I also want all the other records where location.area is the same as that in the record ive extracted.
I can do it on 2 steps - extract record then another query SELECT ... WHERE location.area = 'X'
but can i do it in 1 query ?
members
name, interests, loc_ref
and location
loc_index, address, area
I want to extract all names for a given location that belongs to the member im searching for
eg
SELECT members.name, members.interests, members.loc_ref, location.address, location.area
FROM members,location
WHERE members.loc_ref = location.loc_index
AND members.name LIKE 'smith'
gets the individual record
but I also want all the other records where location.area is the same as that in the record ive extracted.
I can do it on 2 steps - extract record then another query SELECT ... WHERE location.area = 'X'
but can i do it in 1 query ?