SQL WHERE IN (…) sort by order of the list?

后端 未结 5 1328
一生所求
一生所求 2020-12-21 03:27

Let\'s say I have query a database with a where clause

WHERE _id IN (5,6,424,2)

Is there any way for the returned cursor to be sorted in th

5条回答
  •  有刺的猬
    2020-12-21 04:05

    One approach might be to do separate SQL queries with a UNION between each. You would obviously issue each query in the order you would like it returned to you.

提交回复
热议问题