Apologies for this probable newbie question!
Given
My problem is that I want orders part of the result even if no match is found in the "charges table.
For example *, for this country,postcode combo there is nothing defined in charges table.
Or for ** where the postcode format is invalid/not in any range.
I still want these part of the result with a blank charge or a default charge (e.g. 30 in the example).
Doable in one select or do I need to get all the orders and do one select for each order in the java code to calculate the result?
Any help appreciated!
ps DB is 10g and SP is not an option...
Jan
Given
Code:
table orders
id name country postcode
---------------------------
1 A NL 1330
2 A NL 7320
3 B NL 002100
4 C CZ 13005
5 D GB AB3
table charges
country lowpc highpc charge
------------------------------
NL 1000 4999 10
NL 5000 9999 20
GB AA ZZ 25
result
orders.name orders.country orders.postcode ranges.charge
-----------------------------------------------------------
A NL 1330 10
A NL 7320 20
B ** NL 002100 30
C * CZ 13005 30
D GB AB1 25
My problem is that I want orders part of the result even if no match is found in the "charges table.
For example *, for this country,postcode combo there is nothing defined in charges table.
Or for ** where the postcode format is invalid/not in any range.
I still want these part of the result with a blank charge or a default charge (e.g. 30 in the example).
Doable in one select or do I need to get all the orders and do one select for each order in the java code to calculate the result?
Any help appreciated!
ps DB is 10g and SP is not an option...
Jan