SQLVALUES()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to return the single row result of an SQL statement

Syntax

SQLVALUES(<SQL statement>)

See Also

ASTRING(), SELECT, SQLEVAL()

Description

The SQLVALUES() function executes the <SQL statement> and returns the result as a string. Multiple values from a singleton select are returned as a comma-separated list.

If the <SQL statement> returns multiple rows, only the values from the first row are returned, but the results of all rows are available in the automatically created _sqlvalues array.

Example

open database southwind
cTotal = sqlvalues("select max(available), min(available) from example")
 
// Access multiple row results
sqlvalues('select state from example group by state')
? astring(_sqlvalues)
AL,AR,CA,CO,CT,FL,GA,IA,IL,KY,LA,MA,MD,ME,NH,NJ,NY,OH,PA,VA,WI