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

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'm trying to return by selecting directly on 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 table where e-mail=" mailbox stores "or"     

asked by anonymous 22.03.2015 / 19:32

1 answer

1

So I understand you can use the ISNULL function.

ISNULL(estabelecimento.email,usuario.email)

Look if the link below can help you.

link

    
22.03.2015 / 19:43