Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Select Multiple VALUES

Tags:

select

mysql

Totally out of ideas here, could be needing a simple solution.

Basically my desired query is :

SELECT * FROM table WHERE id = 3,4 

I want to select only the row which has ID 3 and 4, or maybe name "andy" and "paul"

Thank you very much for the answer

like image 806
Henson Avatar asked Sep 20 '10 08:09

Henson


People also ask

How do I select multiple items in MySQL?

To select multiple values, you can use where clause with OR and IN operator.

How do I select multiple values from the same column in MySQL?

Note – Use of IN for matching multiple values i.e. TOYOTA and HONDA in the same column i.e. COMPANY. Syntax: SELECT * FROM TABLE_NAME WHERE COLUMN_NAME IN (MATCHING_VALUE1,MATCHING_VALUE2);

How do I select between values in MySQL?

The MySQL BETWEEN OperatorThe BETWEEN operator selects values within a given range. The values can be numbers, text, or dates. The BETWEEN operator is inclusive: begin and end values are included.


1 Answers

Try or:

WHERE id = 3 or id = 4 

Or the equivalent in:

WHERE id in (3,4) 
like image 142
Andomar Avatar answered Sep 18 '22 13:09

Andomar