Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding ALL items not ANY
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00427146
Message ID:
00427181
Views:
18
>>How do you find like all orders that included a hammer AND nails? This is assuming a table normalized like ORDITEMS in TESTDATA. That is one item per record. INLIST(orditems.item,"hammers","nails") works fine for an 'ANY' scenario but not an 'ALL'

>
>
SELECT * FROM Orders ;
>  INTO CURSOR Temp ;
> WHERE OrdID IN (SELECT OrdID FROM OrdItems O1 WHERE item = 'hammer') ;
>   AND OrdID IN (SELECT OrdID From OrdItems O2 WHERE item = 'nails')
>
>I'd make sure that OrdItems had indexes on OrdID and Item.

Cool Ed. Can you continute the AND however many times needed? And what is the 01 and 02? That won't generate an error?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform