mark_h
5th May 2005, 22:56
I have this query:
select tibom010.*, tiitm001.dsca:mitm.dsca,
tiitm001.cuni:mitm.cuni, tiitm001.txta:mitm.txta,
tiitm001.eitm:mitm.eitm, tiitm001.umer:mitm.umer,
tiitm001.effe.a:mitm.effe.a,
tiitm001.opol:mitm.opol,
tiitm001.oltm:mitm.oltm, tiitm001.sftm:mitm.sftm, |#441.sn
tiitm001.cpha:mitm.cpha,
tiitm001_s.oltm:sitm.oltm, tiitm001_s.sftm:sitm.sftm, |#441.en
tiitm001_s.kitm:sitm.kitm, tiitm001_s.dsca:sitm.dsca,
tiitm001_s.cuni:sitm.cuni, tiitm001_s.txta:sitm.txta,
tiitm001_s.eitm:sitm.eitm, tiitm001_s.umer:sitm.umer,
tiitm001_s.effe.a:sitm.effe.a, tiitm001_s.opol:sitm.opol
from tibom010, tiitm001, tiitm001 tiitm001_s
where tibom010._index1 = {:mitm.topl} |#441.n
| where tibom010._index1 inrange {:mitm.topl} |#441.so
| and {:item.t} |#441.eo
and tibom010.mitm refers to tiitm001
and tibom010.sitm refers to tiitm001_s
and tiitm001.kitm = tckitm.manufacture
It does not always return the first position on the bill. Yet if I add order by tibom010._index1 it always works - as I would expect. Since this is the primary index why does the above query not always work? Someone once posted something about using the "order by", but I can not find it.
select tibom010.*, tiitm001.dsca:mitm.dsca,
tiitm001.cuni:mitm.cuni, tiitm001.txta:mitm.txta,
tiitm001.eitm:mitm.eitm, tiitm001.umer:mitm.umer,
tiitm001.effe.a:mitm.effe.a,
tiitm001.opol:mitm.opol,
tiitm001.oltm:mitm.oltm, tiitm001.sftm:mitm.sftm, |#441.sn
tiitm001.cpha:mitm.cpha,
tiitm001_s.oltm:sitm.oltm, tiitm001_s.sftm:sitm.sftm, |#441.en
tiitm001_s.kitm:sitm.kitm, tiitm001_s.dsca:sitm.dsca,
tiitm001_s.cuni:sitm.cuni, tiitm001_s.txta:sitm.txta,
tiitm001_s.eitm:sitm.eitm, tiitm001_s.umer:sitm.umer,
tiitm001_s.effe.a:sitm.effe.a, tiitm001_s.opol:sitm.opol
from tibom010, tiitm001, tiitm001 tiitm001_s
where tibom010._index1 = {:mitm.topl} |#441.n
| where tibom010._index1 inrange {:mitm.topl} |#441.so
| and {:item.t} |#441.eo
and tibom010.mitm refers to tiitm001
and tibom010.sitm refers to tiitm001_s
and tiitm001.kitm = tckitm.manufacture
It does not always return the first position on the bill. Yet if I add order by tibom010._index1 it always works - as I would expect. Since this is the primary index why does the above query not always work? Someone once posted something about using the "order by", but I can not find it.