This repository has been archived on 2024-08-23. You can view files and clone it, but cannot push or open issues or pull requests.
project/sql/search_for_user.sql

11 lines
197 B
SQL

SELECT
user_id, username, email,
GREATEST (
similarity (email, $1),
similarity (username, $1)
) as "similarity!"
FROM
users
ORDER BY
"similarity!" DESC
LIMIT 20