This question is derived from another question
Please refer to it for the context.
Basically I would like to use below SQL query to retrieve a list of records:
Select * From [TableA] Where [A_Design] In ("A", "D", "C" , "B")
As far as I know, "In" clause will not guarantee the retrieved record will follow the same order as ("A", "D", "C" , "B").
My question is how can we achieve this target? Or is it possible if the list is a dynamically generated long list?
Thanks to Gordon Linoff, problem solved! Below is the working solution modified from his example:
select instr(",A,D,C,B,", "," & [A_Design] & ",")
from [TableA]
where [A_Design] In ("A", "D", "C" , "B")
order by 1;
Many thanks to Luis Siquot also, your solution also works, but comparing with Instr() method, codes are little bit longer.