D7 - db_select: order by most recent, commented status
You have a classical case, that requires using 'HAVING' SQL operator. Suppose, we have 2 related tables:

| table1 |
|--------|
|   id   |
|--------|
|    1   |
|    2   |
|--------|


table2.f_id is the FK for table1.id

|         table2        |
|--------+------+-------|
|     id | f_id | order |
|--------+------+-------|
|      1 |    1 |     1 |
|      2 |    1 |     2 |
|      3 |    2 |     3 |
|      4 |    2 |     4 |
|--------+------+-------|


And you want to get all the records from table1 with MAX of the related table2.order. And sort them by table2.order. You must use this SQL to get the data:

SELECT
  table1.id AS id1,
  table2.id AS id2,
  table2.order
FROM
    table1
INNER JOIN
    table2
ON
    table1.id=table2.f_id
GROUP BY
    table1.id
HAVING
    MAX(table2.order)
ORDER BY
    table2.order DESC


And you will get:

| id | id1 | order |
|----+-----+-------|
|  2 |   3 |     3 |
|  1 |   1 |     1 |
|----+-----+-------|


Fiddle

Converting this SQL to Drupal, we'll get this:

$query = db_select("table1");
$query-&gt;innerJoin("table2", NULL, "table1.id=table2.f_id");
$query-&gt;addField("table1", "id", "id1");
$query-&gt;addField("table2", "id", "id2");
$query-&gt;addField("table2", "order", "order_field");

$query-&gt;groupBy("table1.id");
$query-&gt;having("MAX(table2.order)");
$query-&gt;orderBy("table2.order", "DESC");
$result = $query-&gt;execute();
while($row = $result-&gt;fetchAssoc())
{
      var_dump($row);
}


So, for your case, this query must work:

$query = db_select("statuses", "thread");
$query-&gt;innerJoin("fbss_comments", "comment", "comment.sid = thread.sid");
$query-&gt;fields("thread", array("sid", "sender", "created", "message"));
$query-&gt;fields("comment", array("created"));

$query-&gt;groupBy("thread.sid");
$query-&gt;having("MAX(comment.created)");
$query-&gt;orderBy("comment.created", "DESC");
$result = $query-&gt;execute();