If you have a query that's returning 5 identical rows and you really only need one, you can use SELECT DISTINCT:
sql> SELECT DISTINCT foo, bar, baz FROM bing...
An alternative would be appending LIMIT 1 to the end of the query.
distinctduplicateslimitselectsql
You can use this command to show duplicate lines in a file:
$ uniq -d MYFILE
commandsduplicatesfiltershellsortuniq