where is the fault in my join?
You have join the distinct table with watchdog. So the all result of watchdog will be displayed and the matching record of distinct table. So try changing query like : 

$query = db_select('distinct', 'di');
$query-&gt;join('watchdog', 'wa', 'di.wid == wa.wid')
  -&gt;orderBy('wid')
  -&gt;fields('wa', array('variables', 'type', 'severity', 'message', 'wid',
    'timestamp'))
  -&gt;range(0, 20);
$result = $query-&gt;execute();