Original Post
I'm trying to select all the stores that are recommended by the customers friends, based on some criteria. I also want to include in the results all the stores that are not recommended by a friend but meet the criteria So far ive tried: SELECT DISTINCT customers.Fname, stores.StoreID, stores.Name FROM stores, friends, recommendations, customers WHERE ( friends.CustomerID = '7' AND friends.FriendID = recommendations.CustomerID AND customers.CustomerID = friends.FriendID AND stores.StoreID = recommendations.BusinessID AND stores.Suburb LIKE '%gymea%' ) OR ( stores.Suburb LIKE '%gymea%' ) GROUP BY stores.StoreID returns Scott 1 The Big Mexican Rancho Scott 2 Caruso's Gourmet Pizza & Italian Restaurant Scott 3 The Hairy Canary Scott 4 King Palace Chinese & Malaysian Restaurant ------------------------------------------------------------------------------- and SELECT DISTINCT customers.Fname, stores.StoreID, stores.Name FROM stores, friends, recommendations, customers WHERE ( friends.CustomerID = '7' AND friends.FriendID = recommendations.CustomerID AND customers.CustomerID = friends.FriendID AND stores.StoreID = recommendations.BusinessID AND stores.Suburb LIKE '%gymea%' ) OR ( stores.Suburb LIKE '%gymea%' ) returns Scott 1 The Big Mexican Rancho Scott 2 Caruso's Gourmet Pizza & Italian Restaurant Scott 3 The Hairy Canary Scott 4 King Palace Chinese & Malaysian Restaurant lydia 1 The Big Mexican Rancho lydia 2 Caruso's Gourmet Pizza & Italian Restaurant lydia 3 The Hairy Canary lydia 4 King Palace Chinese & Malaysian Restaurant The thing is, Scott has only made one recommendation and thats for storeID = 2, and Lydia is the Fname of the customer that has made the search (her customerID = 7) I want the results to look something like: Scott 2 Caruso's Gourmet Pizza & Italian Restaurant NULL 1 The Big Mexican Rancho NULL 3 The Hairy Canary NULL 4 King Palace Chinese & Malaysian Restaurant It should show the stores that match the criteria and are recommended by friends and then return all the stores that match the criteria minus those that have already been found in the recommendations search.