Fix compatibility issue with older SQLite versions that don't support
ORDER BY clause inside GROUP_CONCAT function.
- Remove ORDER BY from GROUP_CONCAT in SQL queries
- Add GROUP_CONCAT for created_at dates
- Sort IDs manually in Python after fetching results
- Maintain same behavior of keeping oldest prompt as primary
This resolves the startup error:
"sqlite3.OperationalError: near 'ORDER': syntax error"
The fix ensures compatibility with all SQLite versions while preserving
the original functionality of keeping the oldest duplicate.