Difference between revisions of "SQLVALUES()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Function to return the single row result of an SQL statement | Function to return the single row result of an SQL statement | ||
− | |||
==Syntax== | ==Syntax== | ||
SQLVALUES(<SQL statement>) | SQLVALUES(<SQL statement>) | ||
− | |||
==See Also== | ==See Also== | ||
− | [[ | + | [[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== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | + | open database southwind | |
− | + | cTotal = sqlvalues("select max(available), min(available) from example") | |
− | cTotal = sqlvalues(" | + | |
− | + | // 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> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | |||
− | |||
[[Category:SQL]] | [[Category:SQL]] | ||
+ | [[Category:Data Analysis Functions]] | ||
+ | [[Category:Lianja VFP Extensions]] | ||
+ | [[Category:VFP Function Extensions]] |
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