I have 2 tables, one of users and one of confirmed emails, which has a user FK and a confirmed user bool:
- tbl_valida_email
=========================
fk_id_usuario
usuario_confirmado
I was using the following query for this:
SELECT * FROM tbl_usuario WHERE email='email' AND senha='senha' AND (SELECT valido FROM tbl_valida_email WHERE id_usuario=(SELECT id FROM tbl_usuario WHERE email='email' AND senha='senha'));
And in my opinion, it's too complex for a simple thing. How do you improve it?