programming-examples/sql/RetrieveFromTables/Write a SQL query to find all the details of 1970 winners by the ordered to subject and winner name; but the list contain the subject Economics and Chemistry at last.sql

12 lines
352 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/* Write a SQL query to find all the details of 1970 winners by the ordered to subject and winner name;
but the list contain the subject Economics and Chemistry at last.*/
SELECT *
FROM nobel_win
WHERE year=1970
ORDER BY
CASE
WHEN subject IN ('Economics','Chemistry') THEN 1
ELSE 0
END ASC,
subject,
winner;