Search by HasMany relationship

There is a users table and users tables with the properties of the user (user_id, property_id, value)... is it Possible with one query to select the users with several desired properties?

UP. You can select the properties for the parameters, grouped on user_id and select the group where the number of rows in groups equal to the number of properties to search. But I have another table (almost the same as with svoistvami) and it also need to do a search.

UP. Can make a virtual table in which to glue the other three? with fields of type "property_#{id}"... or is it already too?

UP. While found the decision to do several JOINS (depending on the possible number of desired properties). Works, but 6-8 join + 4 the join from other tables not too much?
October 8th 19 at 01:22
2 answers
October 8th 19 at 01:24
I understand the search for properties has helped the article. Pay attention to the queries
October 8th 19 at 01:26
virtual table

Find more questions by tags PostgreSQLSQL