Create PROCEDURE by entering given and checking in 2 tables

0

I have a question on how to do a PROCEDURE, I created a guide image to explain my doubts.

Caption: Yellow table and blue column, linked by line.

The property CASA1 has the ID 23 this property has additional options (features) such as pool, barbecue and so on.

As it is a base with more than 25 thousand records of properties, we created a table to list the features with an ID, Code and Description, in the case of the drawing illustrated as TABLE FEATURE.

We also created a TABLE FEATURE LINK table that contains the feature IDs and the IDs of the properties, in which the property IDs can be repeated because it can have more than one feature, but does not repeat the features by property.

I need to do a PROCEDURE that has the input of the property ID and return organized the features TOGETHER of each property with its ID.

If you can help, thank you.

    
asked by anonymous 13.04.2016 / 16:31

1 answer

1

You can do something like this:

select a.*, b.*, c.* from tabela_imovel a 
  inner join tabela_feature b on a.id=b.id 
  inner join tabela_feature_link c on a.id=c.id 
where EXCLUSÕES
    
13.04.2016 / 17:07