Browse Source

Dao\Thread :: find 追加

sqlite
みてるぞ 9 months ago
parent
commit
2ade56a952
1 changed files with 23 additions and 2 deletions
  1. +23
    -2
      daos/thread.php

+ 23
- 2
daos/thread.php View File

@@ -22,7 +22,7 @@ Thread
LEFT OUTER JOIN LEFT OUTER JOIN
responses AS r responses AS r
ON ON
r.threads_id = t.id
r.thread_id = t.id
WHERE WHERE
t.id <> 1 t.id <> 1
-- AND t.deleted = 0 -- AND t.deleted = 0
@@ -56,7 +56,28 @@ Thread
int $id) int $id)
: \Dto\Thread : \Dto\Thread
{ {
;
// TODO: 書くこと

$sql = "
SELECT
t.id,
t.title,
t.explain,
MAX(r.date) AS latest
FROM
threads AS t
LEFT OUTER JOIN
responses AS r
ON
r.thread_id = t.id
WHERE
t.id = $id
GROUP BY
t.id
ORDER BY
latest DESC";

$result = $db -> query ($sql);
} }






Loading…
Cancel
Save