I have a client table that includes PF and PJ clients. In this table, if the customer has CPF, they do not have a CNPJ, if they have a CNPJ they do not have a CPF. I need a query that checks which of the two columns is not null and returns only it. Type
SELECT nome, (cnpj or cpf) as documento FROM CLIENTES
where ...
My bank is Mysql, but if I have the code in another relational DB I accept, so I can search on.