Q
Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Joining views to extract available information

Expert Shahar Mor explains how to use inner join to extract available information in a table.

Using Client Access, I am joining seven views to get all the scattered info I need. But if one of the views does not exist, the entire order (record) is not selected. CA seems to give me only the "AND" join option. How can I state it so that even if one or two of the views do not exist (no comments, for example), it still considers that order, and extracts the info available?
You are facing a pure "SQL question," not client access. Inner join is the default for DB2. It selects match rows from all the tables/views in the select statement.

Should you need rows to return from primary (left) table even when no match exists in other tables you may use the outer join syntax as follows:

SELECT EMPNO, LASTNAME, PROJNO
FROM CORPDATA.EMPLOYEE LEFT OUTER JOIN CORPDATA.PROJECT
ON EMPNO = RESPEMP

This will return all rows from employees even if the employees have no rows in the project table.

This was last published in October 2007

Dig Deeper on DB2 UDB (universal databases)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close