Hi all
I'm really struggling with this query:
To only select sales orders where the ordered items are in a particular list of items.
In the simplified example below, I would want to select only sales orders containing apples or oranges but not those orders containing any other fruit (regardless of whether apples or oranges were also ordered); my code would therefore need to return only orders 100224, 103744 & 104041.
[highlight]Tables[/highlight]
[tt][blue]
Customer
store
------------
grocer
greengrocer
minimarket
supermarket
concession
tuck-shop
[/blue]
============
[green]
Produce
fruit
------------
apples
pears
oranges
bananas
nectarines
strawberries
blueberries
raspberries
blackberries
[/green]
============
[purple]
Orders
fruit store order_ref
------------ ------------ ---------
apples greengrocer 100001
bananas greengrocer 100001
strawberries greengrocer 100001
nectarines greengrocer 100001
apples minimarket 100224
oranges minimarket 100224
apples supermarket 103052
pears supermarket 103052
oranges supermarket 103052
bananas supermarket 103052
nectarines supermarket 103052
strawberries supermarket 103052
blueberries supermarket 103052
raspberries supermarket 103052
blackberries supermarket 103052
apples tuck-shop 103744
raspberries grocer 104207
strawberries grocer 104207
blackberries grocer 104207
nectarines greengrocer 105326
bananas greengrocer 105326
oranges greengrocer 105326
strawberries greengrocer 105326
oranges concession 104041
[/purple][/tt]
I thought this would be relatively easy but I'm in serious need of assistance and would be very grateful for any hints, tips or solutions.
Mark, somewhere near Blackburn Lancs!
I'm really struggling with this query:
To only select sales orders where the ordered items are in a particular list of items.
In the simplified example below, I would want to select only sales orders containing apples or oranges but not those orders containing any other fruit (regardless of whether apples or oranges were also ordered); my code would therefore need to return only orders 100224, 103744 & 104041.
[highlight]Tables[/highlight]
[tt][blue]
Customer
store
------------
grocer
greengrocer
minimarket
supermarket
concession
tuck-shop
[/blue]
============
[green]
Produce
fruit
------------
apples
pears
oranges
bananas
nectarines
strawberries
blueberries
raspberries
blackberries
[/green]
============
[purple]
Orders
fruit store order_ref
------------ ------------ ---------
apples greengrocer 100001
bananas greengrocer 100001
strawberries greengrocer 100001
nectarines greengrocer 100001
apples minimarket 100224
oranges minimarket 100224
apples supermarket 103052
pears supermarket 103052
oranges supermarket 103052
bananas supermarket 103052
nectarines supermarket 103052
strawberries supermarket 103052
blueberries supermarket 103052
raspberries supermarket 103052
blackberries supermarket 103052
apples tuck-shop 103744
raspberries grocer 104207
strawberries grocer 104207
blackberries grocer 104207
nectarines greengrocer 105326
bananas greengrocer 105326
oranges greengrocer 105326
strawberries greengrocer 105326
oranges concession 104041
[/purple][/tt]
I thought this would be relatively easy but I'm in serious need of assistance and would be very grateful for any hints, tips or solutions.
Mark, somewhere near Blackburn Lancs!