Gossamer Forum
Home : General : Databases and SQL :

PostalCode hell!

Quote Reply
PostalCode hell!
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

Last edited by:

Wiggy: Oct 30, 2002, 2:04 PM
Subject Author Views Date
Thread PostalCode hell! Wiggy 6663 Oct 30, 2002, 1:59 PM
Thread Re: [Wiggy] PostalCode hell!
Alex 6430 Oct 30, 2002, 3:37 PM
Thread Re: [Alex] PostalCode hell!
Wiggy 6413 Oct 30, 2002, 4:53 PM
Thread Re: [Wiggy] PostalCode hell!
cornball 6415 Oct 30, 2002, 6:16 PM
Post Re: [kode] PostalCode hell!
Wiggy 6352 Oct 30, 2002, 7:03 PM