How Do I Affect the Select Statement Sent to the Database? (Magic xpa 2.x)
When you use the Magic xpa Studio to write a task, you will use the Studio interface to quickly write database queries. You don’t need to know how the underlying SQL, ISAM, XML, or memory table query actually works, because the database gateways will handle that.
However, you can affect how an underlying SQL query is structured by how you structure your Magic xpa program.
Note: You can view the SQL Query that is generated using the Debugger. See How Do I View SQL Statements Sent by Magic xpa to the Database?.
Here are the items that affect the SQL Query:
Which columns you choose: The columns you choose will be included in the Query, in the order you selected them in the Data View.
The Magic xpa index chosen (and whether or not it is unique): The Index will be translated into an ORDER BY clause.
The task Ranges: The Ranges will be included as WHERE clauses.
A Task Sort: Any task Sorts that you enter will be translated into an ORDER BY clause.
And, of course, you can also add Direct SQL statements to the Query. See How Do I Send My Own SQL Statements to the Database?.