As far as I know, rows are always added to the end of a DBF file. So, to get the most recent record, I could look for the record with the greatest row number.
Is there some way to know the row number? I'd like to "ORDER BY rownum DESC", does HXTT DBF driver provide this feature?
Thanks,
Daniel Serodio
|
>Is there some way to know the row number? I'd like to "ORDER BY rownum DESC", does HXTT DBF driver provide this feature?
Yeah. If your table hasn't deleted row, you can use:
select * from youtable where recno()=reccount();
or
select * from youtable where _rowid_=reccount();
>As far as I know, rows are always added to the end of a DBF file.
If you can make sure that last inserted row hasn't been deleted, you can still use:
select * from youtable where recno()=reccount();
or
select * from youtable where _rowid_=reccount();
>I'd like to "ORDER BY rownum DESC",
You can use
select ... from youtable order by _rowid_ desc;
For instance,
select ... from youtable where _rowid_>reccount()-1000 order by _rowid_ desc;
will return the last 1000 rows.
select top 10 ... from youtable order by _rowid_ desc;
|