SQL: SELECT id, category FROM categories WHERE sid IS NULL ORDER BY id, sid