Well, how do I query on two tables in sql? For example, I have a Company table with the id , ravelosocial and cnpj fields. I also have another table, Branch with the fields id , address , company_id . I want to do a select of the first table using id, cnpj and a select from the second table using only the address.