Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
I have a view with Customer & CustomerProducts tables inside it. This view has this filter:
CustomerProduct.iProductID = ?vp_iProductID
which obviously will give me a list of all customers that own a certain Product. However, once in a while, I'd like to just show all Customers. Do I HAVE to make a new view? If the filter was based on a STRING instead of an Integer, then I could use a LIKE, and send in "%" whenever I wanted everything. But I can't use "%" here.
Any ideas?
The only dumb idea I could come up with was making two filter lines:
CustomerProduct.iProductID >= ?vp_iProductLowID AND
CustomerProduct.iProductID <= ?vp_iProductHighID
So if I want to show all customers with ProductID #3, just:
vp_iProductLowID = 3
vp_iProductHighID = 3
And if I wanted to show ALL customers:
vp_iProductLowID = 0
vp_iProductHighID = 999999999
(Now you know why I'm asking for a better solution :)
Dustin
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement