i have three tables
customer, people, companies
tables people and companies have a "customerID"
table people have "cpf" and table companies have "cnpj"
i need to query
customerID, (cpf OR cnpj)
Using a union should do the trick. Give this a try:
(SELECT customerID, cpf as cpfORcnpj FROM people )
UNION
(SELECT customerID, cnpj as cpfORcnpj FROM companies)