Previous Topic: Retrieving All ColumnsNext Topic: Eliminating Duplicate Data


Retrieving Selected Columns

Name the columns

To retrieve some of the columns from your table, list the columns you want in the SELECT statement, using a comma to separate each name. CA OLQ displays the columns in the order you enter them. Each column name becomes the column header in the report.

Note: To determine the column names used in the sample tables, look in Appendix A or retrieve all of the table's columns by using an asterisk in the SELECT statement.

Example

List each department's name and manager ID:

select deptname, mgrid from dept ! display

DEPT REPORT mm/dd/yy DEPTNAME MGRID ───────────────────────────────────────────── ───── PERSONNEL 0013 ACCOUNTING AND PAYROLL 0011 INTERNAL SOFTWARE 0003 COMPUTER OPERATIONS 0004 PUBLIC RELATIONS 0007 BRAINSTORMING 0015 THERMOREGULATION 0349 BLUE SKIES 0321 EXECUTIVE ADMINISTRATION 0030 END OF REPORT