I am working on a web app that contains a search function that returns a restaurant when the user submits a query that matches that restaurant.
For example, if the user enters 'Pizza' and enters 'Whiskey', I want the result to output the matching restaurant ONCE.
Instead, this exact query results in the restaurant name appearing multiple times.
Tables:
Foodtbl Drinkstbl Restaurantstbl
SQL Code:
" SELECT r.restname, r.type, r.location, r.website, r.reviews, r.PageLink"
                                    + " FROM restaurants r, food f, drinks d"
                                    + " WHERE SOUNDEX(f.foodcategory) = SOUNDEX(?)"
                                    + " AND SOUNDEX(d.drinkvariety) = SOUNDEX(?)"
                                    + " AND r.restid = f.restid"
                                    + " AND r.restid = d.restid");
While Loop result:
<% while (restResults.next()) { %>
                                    <td><%= restResults.getString("restname") %></td>
                                    <td><%= restResults.getString("type") %></td>
                                    <td><%= restResults.getString("location") %></td>
                                    <td><a href="<%= restResults.getString("website") %>"</a>Go to Website</td> 
                                    <td><a href="<%= restResults.getString("reviews") %>"</a>Go to Reviews</td>
                                    <td><a href ="<%= restResults.getString("PageLink") %>"</a>More Info</td>
Is this a problem with my SQL statement or is it a Loop problem?
Thank you.
 
    