SQLite Forum

Show duplicate rows sorted
Login
Firstly, this would be the query that produces quicker results (as least for my test, considering I have no idea the size and quantity of columns, position of name in your Records table, or whether you also have an Index on name, etc.)

```
SELECT R.*
  FROM (SELECT name FROM Records GROUP BY name HAVING COUNT(*) > 1) AS D
  JOIN Records AS R ON R.name = D.name
 ORDER BY R.name COLLATE unicode
```

Secondly, the [COLLATE ordering term](https://sqlite.org/syntax/ordering-term.html) above is custom for me, but there are standard [loadable extensions](https://sqlite.org/loadext.html) for SQLite that's easy to obtain or compile yourself (if you are using an obscure OS/Processor) which will allow that ability with a typical COLLATE statement like the example above.

Best publicly available one I've used is the [nunicode](https://bitbucket.org/alekseyt/nunicode/src/master/) library, but there may be others. Google is your friend.


PS: I'm not sure if the collate is needed for the "GROUP BY name" also... I think the grouping works regardless, but may need testing.