I need to get from base a last record where `code = variable` and `complete = 0`.

I use this SQL:

```
SELECT email, date FROM users_recovery WHERE restore_key = '" . $code . "' AND complete = '0'

```

For example DB:

```
email - code - complete - date
test@email - code1 - 0 - 1111111
test@email - code2 - 0 - 2222222

```

If variable `$code` will be one of values in DB, then query will perfectly work, but I also need to check is it the last record with this **email** or not, but I don't understand how.