[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

SQL % Sign issues

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?
  • 2
1 Solution
WHERE client number in ('12345','22345','32345')
simplyfemalesAuthor Commented:
DOH!  I should have seen that.  If I could give extra credit, I would.

Any time, its an easy mistake

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now