Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get data from table from a list of strings on MySQL

Tags:

string

mysql

How can I query data from a table available on a list of strings?

I only want to get the data from the list of strings.

Example:
Table
ID Name
1  Big
2  Small
3  Extra
4  Orange
5  Drink

List of Strings:
Big
Small
Extra

Thanks!

like image 769
steamboy Avatar asked Dec 07 '22 03:12

steamboy


1 Answers

I assume you want the MySQL IN clause:

SELECT ID, Name FROM TableName WHERE Name IN ('Big','Small','Extra')
like image 151
Matthew Jones Avatar answered Dec 10 '22 12:12

Matthew Jones