Pages

Friday, July 5, 2024

SQL command to search for a list of data

Have a list of data that you want to look up in a single SQL command?   Here's a syntax you can try.

We'll be using the "IN" command

Data needs to be comma delimited and encapsulated in parentheses 

Select * from TABLE_NAME

where COLUMN_NAME in ('DATA1', 'DATA2', 'DATA3', 'DATA4') 


example

Select * from CustomerData

where UserName in ('JBsmith', 'RDAndrews', 'BIJones', 'KARing') 


No comments:

Post a Comment

Feel free to leave a comment! If you have any information that you think should be included, please do so here and I'll get it added in.