Skip to content
Advertisement

Show data from table even if there is no data

I have 3 tables:enter image description here

Data in Compania table:

enter image description here

Data in Periodo table:

enter image description here

Data in VAC_PERIODOCIA table:

enter image description here

I want to show all the companies (COMPANIA) and the value in (vac_aplica column) searching by Periodo, whether or not they are registered.

I tried this:

Result:

enter image description here

What I want is this:

enter image description here

Advertisement

Answer

First of all, the question is a mess: tables and columns from the question and examples you’ve provided us with are different. Please fix that.

I don’t speak Spanish, so I can only assume the VAC_PERIODICA is Periodo. In that case you need to move what you have in where condition to the join clause. Like this

dbfiddle

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement