Using inner join on a specific record? So we have 2 tables

users:

id | username | email
1  | testuser | test@test.com
2  | dirk     | test2@test2.com


data:

id | data         | username
1  | somedata     | dirk
3  | somemoredata | testuser


I want to select the username of the data table with the id 3 and then select his email. Which is the nicest way to do this with an inner join?
You can get the result by joining your two tables on the username column, then you can use a WHERE clause to filter for the row with id = 3:

select d.id, d.username, u.email
from data d
inner join users u
  on d.username = u.username
where d.id = 3;


See SQL Fiddle with Demo