SQL % Sign issues
Posted on 2011-04-26
I have a table where an organization is identified by a client number. For some of our searches, we must combine these client numbers within an IN statement to get combined results (see below):
Single client data set:
where client number=12345
Client chain data set:
where client number in (12345,22345,32345)
However, within the database, we have previously used the % sign as an identifier for ALL locations within a chain.
Where client number in (12345,22345,32345)
This works just fine
Where client number in (%) does not work. The correct syntax is WHERE client number in ('%')
also WHERE client number in ('12345,22345,32345') does not work - the apostrophes throw it off.
I would rather not hard code each of the % to a list as we add and remove locations within the chain from time to time.
Any suggestions on how to work around this?