SELECT records with field employee # in a series of #

  • Thread starter Thread starter Mark Owert
  • Start date Start date
M

Mark Owert

What is the SQL string to select records with CODE, for example, in a
series of CODES.

SELECT * from employees for code in "2345,4566,5678,7777"

That's the idea, to select employees whose code is one in the series of
the string.

There has to be an easier equivalent to..

SELECT * from employees for code=2345 or code=4566 or...

because the numbercuase.

Thanks
 
If 'code' is numeric:

SELECT * from employees WHERE code in (2345,4566,5678,7777)

If 'code' ic character:

SELECT * from employees WHERE code in ('2345','4566','5678','7777')
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top