-1

In the case where you've specified the following list of numbers, which are in random order, will the results be in the same order?

where item in
(
    371355,
    371476,
    371629,
    370556,
    370677,
    370820,
    370952,
    371070,
    371223,
    372154,
    372253,
    371751,
    371872
)
dnoeth
  • 4,086
  • 9
  • 14
rmgross1
  • 7
  • 1
  • 7
    No. If there is no `ORDER BY` in the query, the results can be in arbitrary order. See a similar question: [Does an IOT guarantee order in a select?](http://dba.stackexchange.com/questions/14570/does-an-iot-guarantee-order-in-a-select/14571#14571) that has the same exact answer: **"The only thing that guarantees result set order is an `ORDER BY` clause in your query."** – ypercubeᵀᴹ Aug 01 '16 at 13:56

1 Answers1

3

NO,

If you do want them to be in order (asc, desc) here is how you would query it...

SELECT T.ITEM
FROM TABLE T
WHERE T.ITEM IN ( 371355
              , 371476
              , 371629
              , 370556
              , 370677
              , 370820
              , 370952
              , 371070
              , 371223
              , 372154
              , 372253
              , 371751
              , 371872
              )
ORDER BY T.ITEM DESC
Hector
  • 1,012
  • 1
  • 8
  • 22