>
select a.callno, a.reservee, b.callno, b.borrower from reserve a, borrower b where a.callno=b.callno>
>how can i use SELECT-SQL to select all records from table reserve even if it does not satisfy the WHERE condition? but display b.borrower when a.callno=b.callno.
>
>pls help.
Use the JOIN option instead of WHERE.
You can use the query builder to help you, at least to get the initial code.
Your code above would be equivalent to:
select a.callno, a.reservee, b.callno, b.borrower;
from reserve a join borrower b on a.callno=b.callno
Just changing JOIN to LEFT JOIN will include all records from the left table (reserve in this case):
select a.callno, a.reservee, b.callno, b.borrower;
from reserve a left join borrower b on a.callno=b.callno
Fields from table "b" will be NULL if there is no matching record. You can solve this with nvl(), for instance:
select a.callno, a.reservee, nvl(b.callno, 00000), nvl(b.borrower, space(30);
from reserve a left join borrower b on a.callno=b.callno
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)