Difference between revisions of "SQLVALUES()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
|||
Line 6: | Line 6: | ||
==See Also== | ==See Also== | ||
− | [[SQL SELECT|SELECT]] | + | [[ASTRING()]], [[SQL SELECT|SELECT]], [[SQLEVAL()]] |
==Description== | ==Description== | ||
− | The SQLVALUES() function executes the <SQL statement> and returns the result as a string. | + | 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== | ==Example== | ||
Line 15: | Line 17: | ||
open database southwind | open database southwind | ||
cTotal = sqlvalues("select max(available), min(available) from example") | 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 | ||
</code> | </code> | ||
Latest revision as of 09:16, 14 March 2013
Contents
Purpose
Function to return the single row result of an SQL statement
Syntax
SQLVALUES(<SQL statement>)
See Also
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