1
I have a relationship that has the chart:
maoObra
(
        id*
    ,   descricao
    ,   valor
    ,   ...
)
And the table:
pecas
(
        id*
    ,   nome
    ,   valor
    ,   ...
)
I have another table:
ItensServico
(
        id*
    ,   data
    ,   pecas_id
    ,   maoObra_id
    ,   ...
)
Where the attributes peca_id and maoObra_id are weak foreign keys in the table of ItensServico.
On the table ItensServico I can get a tuple that either is from the table pecas or the table maoObra and never two, that is, when in a tuple I insert the attribute peca_id, the attribute maoObra_id will be null and the reverse is also true.
I need a query that returns the tuple, but returns the attributes of a table when its foreign key field is NOT null.
Thank you John, that’s what I needed.
– Rafael Christófano