INNER JOIN in 4 tables

1

I have 4 tables:

TB_OS_MANUTENCAO:

TB_OS_ELETRONICA:

TB_OS_MECANICA:

ETB_OS_INFORMATICA:

As shown in the screenshots, all tables have one field in common, the call_id, and also with a common value, 8. This field is not marked UNIQUE and no other type is a normal tinyint field. The problem is that I am not able to write any SQL statement with INNER JOINS that captures ALL (*) the data of the 4 tables where this call_id (8) is equal.

    
asked by anonymous 24.10.2018 / 00:52

1 answer

1
SELECT * FROM TB_OS_MANUTENCAO ma
INNER JOIN TB_OS_ELETRONICA el ON el.id_chamado = ma.id_chamado
INNER JOIN TB_OS_MECANICA me ON me.id_chamado = el.id_chamado
INNER JOIN TB_OS_INFORMATICA if ON if.id_chamado = me.id_chamado
WHERE me.id_chamado = 8

Or

SELECT * FROM TB_OS_MANUTENCAO ma,TB_OS_ELETRONICA el,TB_OS_MECANICA me,TB_OS_INFORMATICA if
WHERE el.id_chamado = ma.id_chamado
  AND me.id_chamado = el.id_chamado
  AND if.id_chamado = me.id_chamado
  AND me.id_chamado = 8
    
24.10.2018 / 01:54