E
E
Edward2020-08-14 11:03:30
MySQL
Edward, 2020-08-14 11:03:30

How to select all rows with certain fields and different values?

There is a table objects. It contains lines with the fields location_region, location_area, location_microarea, location_area. Suppose, when searching, you need to select location_region with id 5, 106, location_area 201, 11. With such a request

SELECT * FROM objects WHERE objects.location_region IN (1,106) AND objects.location_area IN (201, 11)

Only rows with location_region = 1, location_area = 11 are returned. How to write a query correctly so that all rows where location_region = 1 and 106, location_area = 11 and 201 are displayed

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question