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

x
  • 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

However

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

Thx
0
 
cfEngineersCommented:
Any time, its an easy mistake
0

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