Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding ALL items not ANY
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Finding ALL items not ANY
Divers
Thread ID:
00427146
Message ID:
00427146
Vues:
49
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'

I need a single SQL statement if possible that will allow for multiple selections from a listbox to be searched for in a normalized table in an ALL fashion. There may be more than 2 selections so I can't just use a subquery since that's limited to one level deep.

Do I use a self join? Add a column for each item and use GROUP BY ordernum HAVING something? I can do it with multiple SQL statements searching on one item at a time then joining the resultant cursor with the next one but if there's a way to do it in one I'd like it better. I'm building a string that is eventually macro expanded. Thanks!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform