Re: Order of results with "where col in (...)"
Posted in 1998
Jeff Larsen wrote:
>
> Consider the following query:
>
> select col from tab where col in (1, 2, 3);>
> I have tried some simple queries like the above and
> it appears that the results are returned in the order
> of the values in the in() clause. But I can't find any
> documentation that supports this theory.
>
> Is there any guarantee of the order of the results?
>
> Jeff Larsen
> larsen@qec.com
No. The only way is to use ORDER BY. Anything else is unreliable and
dangerous.
If COL is indexed you are likely to see the behaviour you describe. Add
a few joins and it changes. Maybe fragmenting tables would change it
too? Maybe unloading and reloading would?
--
Peter Lancashire
Information Systems Specialist, Bayer plc
Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK
Tel: +44-1635-562258, Fax: +44-1635-562281
---
If all else fails, read the instructions AND the release notes.
All opinions are my own and not those of Bayer plc.
My Internet plumbing does not allow me to mail and post news together.
Sorry.
---
Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/