Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How can I load just the last row from a table?
Order the table descending on the field that determines what is the last row and load the first record:
Table1:
first 1
load * from table order by fieldx desc;
Order the table descending on the field that determines what is the last row and load the first record:
Table1:
first 1
load * from table order by fieldx desc;
Thanks
Especially if you just need one or two values from that row (an index, a timestamp), it is likely faster to use the Peek function and not load/order the data. Negative numbers for Peek's second parameter count starting from the end of the table, so -1 would be the value for the last row.
LET v_LatestTimestamp = Peek('Timestamp Field', -1, 'Table with Timestamp');