I have an audit table that have data for insert, update and delete 开发者_开发百科operations. I am writing a report that will display data in the order of Insert, Update and Delete. I don't think the order by clause will help. any help?
You can use an ORDER BY combined with a CASE clause:
SELECT *
FROM auditlog
ORDER BY CASE operation_type
WHEN 'Insert' THEN 1
WHEN 'Update' THEN 2
WHEN 'Delete' THEN 3
END
精彩评论