I'm pretty sure there's no way to do it, come on ...
I have the following scenario: (include only key fields for brevity)
- Tabela Venda:
- id: int;
- cliente_id: int;
- cliente_tipo: char(1);
- Tabela PessoaFisica:
- id: int;
- nome: varchar(100);
- uf: char(2);
- Tabela PessoaJuridica:
- id: int;
- razao_social: varchar(100);
- uf: char(2);
I did not create the bank and I have to work with it in that way.
My situation is: in certain cases, I have to make queries where I depend on the sale to reach my client and, based on the state where the client is, determine a working rule for it.
The problem is that if my query gets too complex and at many levels of action I realize that the query is slowing down. Then I thought of the indexes.
The problem is that for this, I need to bind an index in the sales table that can relate to both PessoaFisica
and PessoaJuridica
. Is there any way to do this?