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')
 
Back
Top