php - help needed with mysql DISTINCT
114
I'm trying to get names out of a mysql table for an autocomplete (jquery ui). There are duplicate names and I don't want to show them in the suggestions. I also need to select other columns in the same query. is this possible? I'm using this query atm but there are still duplicate "s_name" returned..
SELECT DISTINCT s_name, s_time, s_auto, s_inout FROM testtable where s_name like '%" . mysql_real_escape_string($_GET['term']) . "%'
Answer
Solution:
Use
:
Answer
Solution:
DISTINCT will apply to the entire row - not just the column you stick it in front of. Could you just apply the filtering in PHP after obtaining the data from MySQL?