I currently have 4 SQL tables in this way:
CustomersTable, RegistrationTable, OrdersTable and OffersTable
I have to write a SELECT statement that lists all the clients in the CustomersTable table (all fields), which contain rows in the RegistrationTable table or rows in the OrdersTable table with status "closed", in the result table no must show duplicate clients.
As you can see, CustomersTable and RegistrationTable have the field in common "customerId", but between CustomersTable and OrdersTable there is no common field. However, there is another table (OffersTable) that has the fields "customerId" and "ID", so that information can be consulted to the client tables and orders respectively. Remember that a client that appears in the Offer table will not necessarily appear in the Order table or simply the status field could not be "closed".
Therefore, when executing the query, the following result will be returned:
In the results table you should not show duplicate clients. I really appreciate the help. Thanks for the time !!
Note - I'm using MySQL