Instead of manually typing SQL statements into the SQL box, you can use the Database Item’s point-and-click interface to create complex SQL queries. The Database Items tree lets you select database objects and link them using the SQL SELECT, WHERE, and ORDER BY clauses. After you create a SQL query, you can define any variables using the Variables area of the dialog box.
The next two examples describe two SQL statements and the steps for creating them using the advanced Recordset dialog box’s Database Items tree.
This example selects the entire contents of the Employees table. The SQL statement defining the query appears as follows:
SELECT * FROM Employees
To create this query, follow these steps.
The following example selects two rows from the Employees table, and selects the job type using a variable that you must define. The results are then ordered by employee name.
SELECT emplNo, emplName FROM Employees WHERE emplJob = 'varJob' ORDER BY emplName
Select emplNo, and click the Select button.
Select emplName, and click the Select button.
Select emplJob, and click the Where button.
Select emplName, and click the Order By button.