Chapter Contents

Previous

Next
SAS SQL Query Window User's Guide

Joining Matching Data

An inner join returns a result table for all of the rows in a table that has one or more matching rows in another table. You can use an inner join to display the hourly wage for each employee identification number.

In the previous example, you added SAMPLE.WAGE to the list of Available Tables. Select SAMPLE.SALARY and SAMPLE.WAGE from the list of Available Tables and add them to the list of Selected Tables. Select OK to display the SQL QUERY COLUMNS window. Select Identification Number, JOBCODE, and Hourly Rate from the list of Available Columns and move them to the list of Selected Columns.


Join Types

You can choose to use the results of an inner join or an outer join. See Creating and Using Outer Joins for more information on outer joins.

Select

View
[arrow]
Join Type...

to display the Join Types window.

[IMAGE]

Select Matched Join and OK.


Setting Join Criteria

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

[IMAGE]

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

[IMAGE]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.