I need a SELECT
query with an IN
clause, as well as Order by
:
select *
from table
where column_id IN (5,64,2,8,7,1)
This code returns 1, 2, 5, 7, 8, 64
.
Now I need to return the same select in order
Output needs to be: 5, 64, 2, 8, 7, 1
In Mysql, field option is there, but SQL Server does not have such a field option.
ORDER BY
. So what field are you going to order by? Where does the in list come from? Do you type it in? There is no native way to do what you want.