Previous Topic: Type a SORT StatementNext Topic: Create a Control Break


Select a SORT Column

The format for the SORT statement is typed on line 04 without a table-name because this query uses only one table. Pressing <PF6> presents a list of columns in the current table. This columns can be selected for insertion in the query.

=> TO ORDER THE COLUMNS, ENTER A NUMBER IN FRONT OF EACH ONE --------------------------------------------------------------------------DQB90 DATAQUERY: COLUMN DISPLAY DICTIONARY DATABASE ID: 189 ------------------------------------------------------------------------------- TABLE NAME: CAI-DETAIL-TBL DB NAME: DTL DB ID: 010 ------------------------------------------------------------------------------- COLUMN NAME | DESCRIPTION ------------------------------------------------------------------------------- __ CUST-ID | __ ITM-ID | __ ORD-QTY | __ SHIP-QTY | __ UNIT-PRICE | __ DISC-PCT | __ ACT-DT | __ ACT-YR | __ ACT-MO | __ ACT-DAY | - LAST PAGE ------------------------------------------------------------------- <PF1> HELP <PF2> RETURN <PF3> NOT USED <PF4> NOT USED <PF5> EXTENDED DEFN <PF6> TEXT <PF7> BACKWARD <PF8> FORWARD

Action

To select a SORT column, follow these steps:

  1. Type 1 in the space to the left of CUST-ID.
  2. Press <PF2> RETURN to redisplay the CREATE MODE panel.

Typing 1 when selecting CUST-ID indicates that this column is the first to be inserted in the SORT statement. CUST-ID also happens to be the only column to be used in the SORT statement. If two or more columns were to be used to sort by, then CUST-ID would be the primary sort column.

Pressing <PF2> returns to the CREATE MODE panel, where the selected column is inserted at the location marked with the cursor.

=> --------------------------------------------------------------------------DQD10 DATAQUERY: EDITOR CURRENT TABLE: CAI-DETAIL-TBL ------------------------------------------------------------------------------- NAME: USER-SAMPLE TYPE: QUERY STATUS: PRIVATE DESCRIPTION: TOTAL ORDERS PER CUSTOMER -- AVERAGE PRICE ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+. .. ================================ T O P ===================================== 01 FIND ALL CAI-DETAIL-TBL ROWS 02 WITH SHIP-QTY GT 0 03 SET SHIP-PRICE(7.2) = UNIT-PRICE * SHIP-QTY 04 SORT BY CUST-ID .. =========================== B O T T O M ================================== ------------------------------------------------------------------------------- <PF1> HELP <PF2> RETURN <PF3> DISPLAY COLUMNS <PF4> DISPLAY KEYS <PF5> DISPLAY ALL <PF6> LIST TABLES <PF7> BACKWARD <PF8> FORWARD <PF9> TEMPLATE <PF10> VALIDATE <PF11> RIGHT/LEFT <PF12> PROCESS MODE