Hello-
I have a text search which searches properly. Please see my code below. The problem is the db has some (not all) duplicate data using the column: Name.
In my queries below, if I only use 'DISTINCT name', it returns distinct results BUT
I need the query to return not only the column Name, but also the columns ID, address, city, state.
If I use 'SELECT DISTINCT Name, ID, Address, City, State', as below, the search results are no longer distinct.
How can I solve this? Should I somehow detect the duplicate row with the highest auto-incremented ID instead of DISTINCT? I tried adding Max(ID) but I can't get that to work either.
Thanks.
$query = mysql_query("SELECT DISTINCT Name, ID, Address, City, State, MATCH(Name,Address,City,Details,LongDetails) AGAINST('$keywords' IN BOOLEAN MODE) as relevance FROM UserInfo WHERE MATCH(Name,City,Details,LongDetails) AGAINST('$keywords' IN BOOLEAN MODE) ORDER by Name");