The format of SQL queries requires you to select columns before you select tables.
To select columns: Type SELECT, followed by the names of the columns in the order that you want them to appear on the report. Use commas to separate the column names.
For example, to select the DEPTNAME and DEPTNUMB columns, type:
SELECT DEPTNAME, DEPTNUMB
To select all the columns to view on the report, type:
SELECT *
To find column names: If you know the table from which you want to select data, but don't know all the column names, you can use the Draw function key on the SQL Query panel.
For example, to find the names of the columns in the Q.ORG table, type Q.ORG.
QMF displays a query that selects all the columns for the table you specified:
SELECT DEPTNUMB, DEPTNAME, MANAGER, DIVISION -- Q.ORG , LOCATION -- Q.ORG FROM Q.ORG
To select tables: Type FROM, followed by the name of the table from which you want to select data.
For example, to select the Q.ORG table, type:
FROM Q.ORG
If you need to see a list of tables, use the LIST TABLES command. For more information on the LIST TABLES command, see Displaying a list of database objects using the LIST command.