I am trying to perform a SQL query with PDO, that will select data from two different tables, and match them together:

```
$stmt = $dbh->prepare("
    select a.token, b.token, b.username, COUNT(DISTINCT a.token) adcount, COUNT(DISTINCT b.username WHERE a.token=b.token) clickcount
    from advertisements a, advertisement_clicks b
    where a.status='2' AND (a.clicks_left > 0 OR a.fixed ='1')
    AND b.token=a.token
    ");
    $stmt->bindParam(':userid', $userdata["id"]); 
    $stmt->execute();
    $s1=$stmt->fetch();

```

So, above SQL doesn't work. I am trying to select ***amount*** of records where `a.token` matches `b.token` as `clickcount`

How can I achieve this?