您可以用不同的值交换null的实例,以首先(如0或-1)或最后(大数字或字母)对它们进行排序。
SELECT field1, IF(field2 IS NULL, 9999, field2) as ordered_field2 FROM tablename WHERE visible = 1 ORDER BY ordered_field2 ASC, id DESC