Hopefully this will help explain exactly what I'm trying to do:
Code:
1. TABLE state
stateID -> ID index = 1 -> PRIMARY KEY (current index number is 1)
statename = "Alaska" -> ID index = 2
statename = "Alaska" -> ID index = 3
2. TABLE city
cityID -> ID index = 1 -> PRIMARY KEY
cityname = "Anchorage" -> ID index = 2
cityname = "Anchorage" -> ID index = 3
3. TABLE event
eventID -> ID index = 1 -> PRIMARY KEY
skiing -> ID index = 2
skiing -> ID index = 3
4. TABLE resorts
resortsID -> ID index = 1 -> PRIMARY KEY
resortnames = "Big Red" -> ID index = 2
resortnames = "Big Red" -> ID index = 3
5. TABLE reviews
reviewsID -> ID index = 1 -> PRIMARY KEY
reviews = "I loved it! Will go again! 5 stars! -> ID index = 2
reviews = "I HATED it! Don't waste your money! -> ID index = 3
User A submits the above information (Anchorage, Alaska and Big Red) after reviewing and rating it.
User B comes along and does the same thing for the same place.
Now User C comes along and wants to know about skiiing in Alaska so they do a search on "skiing in Alaska" and what I want to happen is only one result come up for "Big Red Ski Resort - Anchorage, Alaska" regardless of how many users submitted reviews and ratings etc for "Big Red - Anchorage Alaska", but I do want all reviews, ratings etc to be viewable on the page of Big Red, Anchorage Alaska itself.
With that said, I'm trying to restrict searches based on area searched for example, if a user decides to search for ski resorts called "Big Red" in say, Switzerland, I don't want Alaska popping up UNLESS they did a blanket search for "Big Red" without specifying region etc.
I think DISTINCT is what I'm looking for so I'll play with it to see the results.
Bookmarks