Mysql subquery with where clause

Viewed 115

i need a little bit of help. I have three tables and there names are hall, hall_quantified_details and hall_hall_quantified_details, and they looks like this:

Hall

hall_id | hall_name
   1        Hall 1
   2        Hall 2

hall_quantified_details

hall_quantified_details_id | name_quantified
           1                       space
           2                       seats

hall_hall_quantified_details

hall_hall_quantified_details_id | hall_id | hall_quantified_details_id | value
          1                         1               1                     100m2
          2                         1               2                     500seats

And i want to get back with query name of value and value for hall_id 1, i have query, but it gives me back only name of hall_quantified_details_id... Query looks like this:

SELECT p.name_quantified
FROM hall_quantified_details p 
WHERE p.hall_quantified_details_id  IN (
      SELECT pns.hall_quantified_details_id
      FROM hall_hall_quantified_details pns 
      WHERE pns.hall_id = 1
 );

So i wish to get back for hall_id 1 from hall_hall_quantified_details result that looks like : space 100; seats 500seats.

1 Answers
Related