‎2008 Feb 19 4:51 PM
Hello All,
I have a Z table and there is SQL that get's the latest record from the Ztable.
SELECT * FROM ZXXX WHERE TYPE = '01'. ENDSELECT.
For example there is a column called template in this Z table whose 1st record has value 100001 and last record has value 100029. Yesterday the SQL above was getting the latest record for example 100029 and today I run the same SQL and it is not getting the latest record!! It get's some other record from the middle for example with value 10001! Is there any reason why this behavior happens? Any suggestions please..
Thanks.
Mithun
‎2008 Feb 19 5:10 PM
The order in which data is returned is not guaranteed uless you specify an order. Try :
SELECT * FROM zxxx
UP TO 1 ROWS
WHERE type = '01'
ORDER BY zz_field DESCENDING.
ENDSELECT.
Rob