Previous Page | Next Page

Examples

Joining Matching Data

The data that you need for a report could be located in more than one table. In order to select the data from the tables, you join the tables in a query. Joining tables enables you to select data from multiple tables as if the data were contained in one table. Joins do not alter the original tables.

The SQL Query Window supports two types of joins:

For this example, you use an inner join to display the hourly wage for each employee identification number.

In the previous example, you added SAMPLE.WAGE to the Available Tables list. Select SAMPLE.SALARY and SAMPLE.WAGE from the Available Tables list and add them to the Selected Tables list. Select OK to display the SQL QUERY COLUMNS window.

Select Identification Number, JOBCODE, and Hourly Rate from the Available Columns list and move them to the Selected Columns list.


Choosing a Join Type

Select View [arrow] Join Type to display the Join Types window.

[Join Types]

Select Matched Join and OK.


Setting Join Criteria

In the Columns for Setting Join Criteria window, select Salary from both the SAMPLE.SALARY Columns list and the SAMPLE.WAGE Columns list. Select JOBCODE from the SAMPLE.SALARY Columns list and select Job Code from the SAMPLE.WAGE Columns list.

[Specifying join criteria]

Select OK to return to the SQL QUERY COLUMNS window.


Viewing Your Output

To run your query and view the output in the Output window, select Tools [arrow] Run Query [arrow] Run Immediate.

[Query output]

Previous Page | Next Page | Top of Page