Bandayar
Bandayar

Reputation: 164

Select values based on multiple keys

I am New to sql

I have Select boxes on my page when a user selects from that boxes and click submit all of the info will be pulled from a single table with the given multiple select boxes values is it possible to put multiple values in WHERE

Regards'Sajid

Upvotes: 0

Views: 1332

Answers (2)

MrFusion
MrFusion

Reputation: 911

You can have a query like this (example):

SELECT * FROM myTable
WHERE price < 80 
    AND price > 30
    AND comments IS NOT NULL
    AND category = 'snacks'
    AND ...

Upvotes: 0

Silver Light
Silver Light

Reputation: 45912

You will need an IN operator:

SELECT *
FROM `table_name`
WHERE `column_name` IN (1, 2, 3, 4, 5) -- comma separated list of values

Upvotes: 1

Related Questions