Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

outer joins in filter

Status
Not open for further replies.

timida

MIS
Feb 1, 2004
43
AT
Hi!

I have again an outer join problem...
I have created a report which displays the deliveries of container within a specific period (2 type-in date prompts ?start? and ?end?).
This report also should display a container, if there was no delivery to this container (within the period).
Note: I'm using Impromptu 7.0 and a oracle 8 DB.

The deliveries are stored in table DELIVERY.
The containers are stored in the table CONTAINER.
The discharging point is storied in the table DISC.

CONTAINER
nr
con_name

DELIVERY
nr
date
qty

DISC
nr
con_nr (join zu container)
del_nr (join zu delivery)

The joins are defined as followed:
CONTAINER.nr = DISC.con_nr(+)
DISC.del_nr = DELIVERY.nr(+)

I want to display the container.nr and - if there are deliveries - the delivery number and the quantity. I filter the report to the delivery-date.

Filter:
delivery.date >= ?start? and delivery.date < ?end?

The SQL generated from impromptu:
select delivery.nr, delivery.date, container.nr
from container, disc, delivery
where disc.del_nr = delivery.nr(+)
and container.nr = disc.con_nr(+)
and delivery.date >= to_date('2004-01-06', 'YYYY-MM-DD')
and delivery.date < to_date('2004-01-09', 'YYYY-MM-DD')

I tried the solution from thread401-608831:
...
and (delivery.date >= to_date('2004-01-06', 'YYYY-MM-DD') or delivery.date is null)
and (delivery.date < to_date('2004-01-09', 'YYYY-MM-DD') or delivery.date is null)

but this does not help.

When I insert in the sql manually:
...
delivery.date (+)>= to_date('2004-01-06', 'YYYY-MM-DD')
delivery.date (+)< to_date('2004-01-09', 'YYYY-MM-DD')

I get the right results - all container-numbers and if there are deliveries in the period, the deliveries.

Any help would be greatly appreciate!
Timida
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top