Select users that do have certain roles and do not have others I need some help with my SQL in that I want to get all users with a certain role that do have another role.

SELECT distinct users.uid, users.name, users.mail
FROM users AS users, users_roles AS ur
WHERE ur.uid = users.uid
AND ur.rid &lt;&gt; 4 
AND ur.rid = 13


My SQL is really bad so any help would be appreciated.
According to Drupal db_select API Use this to fetch user id and names that user have roleId 13 and not have roleId 14

$query = db_select('user', 'u');
$query-&gt;join('role', 'ur', 'u.uid = ur.uid'); 
$query-&gt;fields('u',array('uid','name'))
 -&gt;condition('ur.rid', 13)
 -&gt;condition('ur.rid', 14,'&lt;&gt;');
 $result = $query-&gt;execute()-&gt;fetchAll();
dpm($result);