I\'m trying to perform a SELECT
with an IN
clause and I would like to be able to have the results returned in the same order as the elements in my list
I'm not a Python guy, but here's how I'd do it in PHP and I hope you get the idea.
Build a string like this:
$str = "('B123', 'B483', 'B100', 'B932', ...)";
For the above, you can use a for loop or something to build a really long string.
Insert the string in the query like this:
$MyQuery = "SELECT * FROM orders WHERE order_no IN $str ORDER BY $str";
Like I said, this is a PHP example, but I believe you get the idea.