Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


sort by order of values in a select statement in clause in mysql


sort by order of values in a select statement in clause in mysql  using -'mysql,select'

I'm selecting a set of account records from a large table (millions of rows) with integer id values.  As basic of a query as one gets, in a sense.  What I'm doing us building a large comma separated list, and passing that into the query as an "in" clause.  Right now the result is completely unordered.  What I'd like to do is get the results back in the order of the values in the "in" clause.

I assume instead I'll have to build a temporary table and do a join instead, which I'd like to avoid, but may not be able to.

Thoughts?  The size of the query right now is capped at about 60k each, as we're trying to limit the output size, but it could be arbitrarily large, which might rule out an "in" query anyway from a practical standpoint, if not a physical one.

Thanks in advance.
    

asked Sep 16, 2015 by patilkiran.101
0 votes
11 views



Related Hot Questions



Government Jobs Opening


...