null values at the bottom of a sql table – sql server 2000

Use aggregation instead:

SELECT user_index, name, email
FROM table1
GROUP BY user_index, name, email
ORDER BY (CASE WHEN email IS NULL THEN 1 ELSE 0 END);

This is functionally the same as your question. However, the SQL engine will not get confused about an expression that uses a distinct column.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top