Previous Topic: Understanding the ReportNext Topic: Define Report


Creating the Sample Query

The next section describes creation of the query that produces the sample objective report. Following is an example of how the query looks on the Editor panel:

 =>  --------------------------------------------------------------------------DQD10  DATAQUERY:  EDITOR            CURRENT TABLE: ________________________________  -------------------------------------------------------------------------------  NAME:          SQLBASIC                          TYPE: SQL     STATUS: PUBLIC  DESCRIPTION:   SAMPLE BASIC QUERY     ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+.  .. ================================ T O P =====================================  01 SELECT  REP_ID, ORD_AMT, NAME  02 FROM GLS_CUST_TABLE, GLS_ACCTS_TABLE  03 WHERE GLS_CUST_TABLE.CUST_ID = GLS_ACCTS_TABLE.CUST_ID  04       AND GLS_ACCTS_TABLE.ORD_AMT >= 01000.00  05 ORDER BY REP_ID, ORD_AMT, NAME  .. ===========================  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

The following chart provides a brief description of the four basic SQL clauses.

Clause Type and Keyword

Predicate

Description

SELECT

Column names

Names columns containing data wanted on the report. Specifies order of output columns.

FROM

Table names

Specifies the names of tables where the columns named in the SELECT clause are found.

WHERE

 

Search condition

Specifies criteria that data must meet to be used for joining tables or selecting rows.

 

ORDER BY

Column names

Specifies sorting order for data as it appears on the report.

CA Dataquery permits the use of a number of SQL keywords. See the CA Dataquery Reference Guide or the CA Datacom/DB SQL User Guide for complete information about the following SQL keywords accepted by CA Dataquery: