Suppose you have the following SQL SELECT statement:
SELECT EMPLOYEE.JOBCODE, WAGES.GROSSPAY, EMPLOYEE.NAME
FROM EMPLOYEE, WAGES
WHERE (EMPLOYEE.NUMBER = WAGES.EMPNUMBER) AND (EMPLOYEE.STATE = 'NC')
ORDER BY EMPLOYEE.JOBCODE ASC, WAGES.GROSSPAY DESC
To specify the statement:
- In the Query name field, type a name for the SELECT
statement.
- In the Description field, type a description for the SELECT
statement.
- In the Tables/views list, select EMPLOYEE and
WAGES.
- In the Columns list, select EMPLOYEE.JOBCODE,
EMPLOYEE.NAME, and WAGES.GROSSPAY.
- In the Column sequence list, select
EMPLOYEE.NAME.
- From the Column sequence pop-up menu, select Move
after > WAGES.GROSSPAY.
- From the Clause menu, select WHERE.
Next, in the displayed WHERE Details window:
- In the Left operand field, select
EMPLOYEE.NUMBER.
- In the Operator field, select =.
- In the Right operand field, select
WAGES.EMPNUMBER.
- Select Add to operand lists.
- In the Left operand field, select
EMPLOYEE.STATE.
- In the Operator field, select =.
- In the Right operand field, type
NC
- From the Unary operator menu, select Right operand
String constant 'x'.
- Select Add to operand lists.
- In the Left operand field, select (EMPLOYEE.NUMBER
= WAGES.EMPNUMBER).
- In the Operator field, select AND.
- In the Right operand field, select (EMPLOYEE.STATE
= 'NC').
- Select Apply.
Finally, complete the statement:
- From the Clause menu, select ORDER BY.
- In the ORDER BY Details window, do the following:
- In the Columns list, select EMPLOYEE.JOBCODE
and WAGES.GROSSPAY.
- In the ORDER BY sequence list, select
WAGES.GROSSPAY.
- From the ORDER BY sequence pop-up menu, select Descending
(DESC).
- Select Apply.