MMQuery

Query your databases without relationships.

<- Back to MMQuery function list

MMQuery_ExecuteSQL

Description

This function allows you to use SQL statements to run queries against the current Database File. If the Query you are using will be returning Field values and multiple Records, you can optionally define the Separators that should be placed between the Fields and Records using the last two parameters. By default, MMQuery will use a comma between multiple Fields and a return between multiple Records. The Field and Record Separators you specify are not limited to a single character.

Return Type
Text
Format
MMQuery_ExecuteSQL ( SQL ; FieldSeparator ; RecordSeparator )
Required Parameters
  • SQL

    The SQL statement to evaluate against the current Database File.

Optional Parameters
  • FieldSeparator

    The Separator to use between multiple Fields when doing an SQL Select. By default, Fields will be separated with a comma.

  • RecordSeparator

    The Separator to use between multiple Records when doing an SQL Select. By default, Records will be separated with a return.

Related Items
MMQuery_EscapeQuotes, MMQuery_ExecuteSQLEx, MMQuery_GetAsSQLDate, MMQuery_GetAsSQLTime, MMQuery_GetAsSQLTimestamp
Examples

Example 1

Code:

MMQuery_ExecuteSQL("select * from MyTable")

Result:

Returns every field and every record from the "MyTable" Table.

Example 2

Code:

MMQuery_ExecuteSQL("select '<tr><td>' + \"First\", \"Last\" + '</td></tr>' from MyTable";"</td><td>")

Result:

Returns something like "<tr><td>Mary</td><td>Jones</td></tr>" for every record in the "MyTable" Table.