DRJOIN
To right join tables within a query.
Example
REM Define the database connection and assign the results to the menu& variable.
DATA menu&
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 "menu.*, IF(pages.url != '', pages.url, menu.external_link) AS url"
REM Join the menu table with pages.
DRJOIN "pages ON pages.id=menu.page_id AND pages.deleted_at IS NULL"
REM Condition the select to those that aren't deleted.
DWHERE "menu.deleted_at != NULL"
REM Sort the results by their name alphabetically.
DSORT "menu.name ASC"
END DATA
REM Loop through the results stored in menu& variable.
FOR item& IN menu&
LINK item&["url"],item&["tooltip"]
PRINT item&["name"]
LINK CLOSE
END FOR