I have a schema that looks like this:
+------------+
+------------+ | acc_email |
| account | +============+
+============+ | id |
| id |<-+-+ account_id |
+------------+ | | email |
| +------------+
| +------------+
| | password |
| |============|
| | id |
+--+ account_id |
| password |
| iterations |
| salt |
+------------+
The users login via email, need to find the account, than find the password. I got this far:
SELECT *
FROM acc_email
LEFT JOIN account
ON acc_email.account_id = account.id
How do I join and retrieve the account email, account and latest password in a single query?