Return data from one table if it does not exist in another

Asked

Viewed 44 times

2

I have an environment where there are two forms of login and tables "Users" and "Establishments", these tables are very similar and I need to return this query based on the email typed in the login form.

I am trying to return by selecting directly in both tables, but it is not correct. ex:

SELECT * FROM {$tabelas->estabelecimentos} as estabelecimento, {$tabelas->usuarios} as usuario WHERE estabelecimento.email = %s OR usuario.email = %s LIMIT 1

But what I need is this: "Select from the establishments table where email = email OR if there is no select from the users table where email = email"

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.