What I'm trying to do is search through my table and count the instances of a letter, and store the ID of each instance in mysql and php (PDO).

What I had been messing around with is this:

```
$user = 'john';
$stmt = $pdo->prepare("SELECT id, SUBSTR(surname, 1, 1) as surname_init,COUNT(*) as count FROM first_table WHERE user = :user GROUP BY surname_init ORDER BY count DESC");
$stmt->bindValue(":user", $user);

$stmt->execute();
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);

var_dump($row);

```

This is the result:

```
array (size=2)
  0 => 
    array (size=3)
      'id' => string '3' (length=1)
      'surname_init' => string 'B' (length=1)
      'count' => string '2' (length=1)
  1 => 
    array (size=3)
      'id' => string '7' (length=1)
      'surname_init' => string 'D' (length=1)
      'count' => string '1' (length=1)

```

So I have two results: B has 2 instances, D has one. However "B" has only one resulting id returned from two.

Is this possible? I think I'm missing something here..