We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


SQL % Sign issues

Medium Priority
Last Modified: 2012-05-11
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:
select *
from table
where client number=12345

Client chain data set:
select *
from table
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?
Watch Question

Unlock this solution with a free trial preview.
(No credit card required)
Get Preview


DOH!  I should have seen that.  If I could give extra credit, I would.

Any time, its an easy mistake
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.