简体   繁体   中英

h2db order by field

I have a list of IDs from Lucene Search engine and want to select these IDs from database in specific order (score).

Can I do that in SQL query? It seems like h2 doesn't know ORDER BY FIELD(id, <list,of,ids>) function - Function "FIELD" not found.

Thank you.

SELECT * FROM table WHERE id IN (3,1,2,4) ORDER BY FIELD(id, 3,1,2,4);

这是您需要的吗?

SELECT * FROM table WHERE id IN (3,1,2,4) ORDER BY decode(id,3,1,1,2,2,3,4,4,5);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM