Good afternoon, how could I get the following result from the image:
in sql server since I have 3 tables of which 2 inherit from a main one, but when doing a join between these tables I double the value
Use LEFT JOIN
as follows
SELECT *
FROM TABLA1
LEFT JOIN TABLA2 ON TABLA1.id_tabla1 = TABLA2.id_tabla1
LEFT JOIN TABLA3 ON TABLA1.id_tabla1 = TABLA3.id_tabla1
What it does is that it returns all the records of the table on the left (TABLE1) and pastes all the records of the second table that meet the condition to the right, the condition put after ON . As in all the tables you refer to the ID of table 1, I used that ID.
As you can see, several tables can be added using this type of JOIN.
What happens when the condition is not met? The records remain as null. As your desired result appears in the image you shared.