Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
farolito20
Contributor III
Contributor III

Load last row

How can I load just the last row from a table?

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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;


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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;


talk is cheap, supply exceeds demand
farolito20
Contributor III
Contributor III
Author

Thanks

msteedle
Partner - Creator
Partner - Creator

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');