DLIMIT
Limit the results of a database query.
Example
DATA
REM Open the database connection from the config file labelled kytschBASIC.
DOPEN "kytschBASIC"
REM Read from the menu table in the database.
DREAD "menu"
REM Select all entries from the menu table.
DSELECT "*"
REM Condition the select to those that aren't deleted.
DWHERE "deleted_at IS NULL"
REM Sort the results by their name alphabetically.
DSORT "name ASC"
REM Limit the result.
DLIMIT "1"
REM Fetch the results and assign them to menu variable.
DFETCH menu#
END DATA
REM Loop through the results stored in menu& variable.
FOR item& IN menu#
SWRITE
PRINT item&("id")
LINE BREAK
PRINT item&("name")
END SWRITE
NEXT
Output
7
Database
Sort directions
ASC is ascending, i.e. A-Z
DESC is descending, i.e. Z-A
DESC is descending, i.e. Z-A