Selecting specific rows from a table and ordering the results

Selecting specific rows from a table and ordering the results

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

To create this query:

  1. Expand the Tables branch to display all of the tables in the selected database; then expand the Employees table to display the individual table rows.
  2. Build the SQL statement as follows:
    • 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.
  3. Place the insertion point after WHERE emplJob in the SQL text area and type ='varJob' (include the equal sign).
  4. Define the variable 'varJob' by clicking the Plus (+) button in the Variables area and entering the following values in the Name, Default Value, and Run-Time Value columns: varJob, CLERK, Request("job").
  5. Click OK to add the recordset to the Bindings panel.


Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Defining Sources of Dynamic Content
Developing Applications Rapidly