I have a doosey of a problem...
I have a table holding the postal codes in a salesperson's territory, however, it only contains the BEGINNING of a postal code
(EX. L9 would give you any companies that have a postal code that starts with L9)
I have my search running like this:
SELECT * FROM Companies WHERE PostalCode LIKE 'L9%' OR PostalCode LIKE 'K4'
but if there are too many postalcodes for that salesperson, I get a "Query too complex" error. I would like to use the "LIKE ANY" Condition, but I can't then use a wildcard (EX ...WHERE PostalCode LIKE ANY(SELECT PostalCode FROM SalesPostalCodes WHERE SalesPerson=1) )
Does anybody know a solution to my problem? Is there any way to use a Wildcard in a "LIKE ANY" condition?
Thank you very, VERY much
I have a table holding the postal codes in a salesperson's territory, however, it only contains the BEGINNING of a postal code
(EX. L9 would give you any companies that have a postal code that starts with L9)
I have my search running like this:
SELECT * FROM Companies WHERE PostalCode LIKE 'L9%' OR PostalCode LIKE 'K4'
but if there are too many postalcodes for that salesperson, I get a "Query too complex" error. I would like to use the "LIKE ANY" Condition, but I can't then use a wildcard (EX ...WHERE PostalCode LIKE ANY(SELECT PostalCode FROM SalesPostalCodes WHERE SalesPerson=1) )
Does anybody know a solution to my problem? Is there any way to use a Wildcard in a "LIKE ANY" condition?
Thank you very, VERY much