E
E
Egor Sh2016-11-16 20:30:10
MySQL
Egor Sh, 2016-11-16 20:30:10

How to make a selection from the database on a get request with a filter parameter?

Good day.
There is a get request like api.site.ru/v1/getall?filter=1,3,5
I parse the filter parameter and get 1,3,5
Is it possible to somehow write a query to the database so that it looks like:
SELECT * from EVENTS where event_type =1,3,5
or you have to write everything like this:
SELECT * FROM events WHERE filter = 1 OR filter = 3 OR filter = 5;
Thanks a lot.
ps In api vk there are requests like "filter=post, friend, photo" I need to somehow implement it myself, maybe you know how to do it right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2016-11-16
@deliro

SELECT * FROM events WHERE filter IN (1,3,5);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question