PostgreSQL Query Incorrect Sorting Order for Alphanumeric Strings
I am trying to sort a column title from the table door with the following PostgreSQL query: SELECT title FROM door ORDER BY CASE WHEN title ~ '^d+' THEN CAST(regexp_replace(title, '[^0-9]', '', 'g') AS INTEGER) ELSE NULL END ASC, CASE…