不建新表前提下自定义排列顺序的问题
sql= "select * from shop_books where bookid in (120,131,128,127,135,140,133,132) "
这样的结果得出来的顺序将并非按照(120,131,128,127,135,140,133,132)这个顺序
请问,如何在不建新表的前提下,利用order by和array实现按(120,131,128,127,135,140,133,132)排列的结果顺序
,ACCESS环境,CHARINDE无效,谢谢!
------解决方案--------------------try
sql= "select * from shop_books where bookid in (120,131,128,127,135,140,133,132) Order By InStr( '120,131,128,127,135,140,133,132 ',bookid) "
------解决方案--------------------sql= "select * from shop_books where bookid in (120,131,128,127,135,140,133,132) order by iif(bookid=120,1,iif(bookid=131,2,iif(bookid=128,3,iif(bookid=127,4,iif(bookid=135,5,iif(bookid=140,6,iif(bookid=133,7,iif(bookid=132,8,9)))))))) "