如何在我的自动建议程序中限制相同的搜索结果? [关闭]

I have a table named Pets that has a column of owner_name. The user wants to put the owner's name and it will suggest the possible owner names kinda like if I put Jo on the search box, it suggests John,Jonathan,Joshua,Jorge. But the problem is, there are times when an owner has multiple columns under their name with different pets. Kinda like John owns a cat,dog,bird. My program does the search suggestion but the problem is that it repeats the names, so if I typed Joh it lists three Johns on the auto suggest. Out of curiosity I tried the LIMIT 1 but as expected, what it did was limited the entire results to 1 so if I put Jo, it just displays John.

Use the DISTINCT keyword. Try something like:

SELECT DISTINCT columnname
FROM query
WHERE ....