Create PROCEDURE by entering given and checking in 2 tables

Asked

Viewed 31 times

0

Guys I’m having a doubt on how to make a PROCEDURE, I’ve drawn up a guide image to explain my doubt.

Legend: Table in yellow and column in blue, linked by row.

Imagem Guide

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

As it is a base with more than 25 thousand records of real estate, 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 create a table TABLE FEATURE LINK that contains the Ids of the Properties and the Ids of the Immovables, in it the Ids of the Immovables can be repeated because it can have more than one Feature, more does not repeat the Properties by immovable.

I need to make a PROCEDURE that has the immovable ID input and return organized the JOINTS Features of each immovable with its ID.

If you can help.

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.