kytschBASIC

Put down that phone!
Please view me on real computer.

DRJOIN

To right join tables within a 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 "menu.*, IF(pages.path != '', pages.path, 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 IS NULL"



	REM Sort the results by their name alphabetically.

	DSORT "menu.name ASC"



	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&

	LINK item&("url"), item&("tooltip")

		PRINT item&("name")			

	END LINK

NEXT

See also