Select columns from a table

To select columns from a table enter SELECT, followed by the exact names of the columns in the order (left to right) you want them in your report. Separate column names by a comma.

With automatic reordering, the following statement produces a report with the department names on the left and the department numbers on the right:

SELECT DEPTNAME, DEPTNUMB
FROM Q.ORG

You can change the order of columns in the report by changing the form. The order of the columns on the form is the same order in which they are named in the query.

You can select a column more than once; this allows you to use multiple aggregating functions on the form.

You can select up to 750 column names (or expressions) in OS/390 and up to 255 in VM and VSE.

You can use a column name in a WHERE clause without using the column name in the SELECT clause.

Examples:

[ Previous Page | Next Page | Contents | Index ]