diff --git a/routes/myboardRouter.js b/routes/myboardRouter.js index 5b367b1..d003eea 100644 --- a/routes/myboardRouter.js +++ b/routes/myboardRouter.js @@ -9,27 +9,27 @@ router.get('/', function(request, response) { if (request.user === undefined) { response.redirect('/'); } - db.query(`SELECT post.id, post.title, post.createdate, count(*) 'count' - FROM (SELECT * FROM post WHERE post.userId=${request.user.id}) post, liked - WHERE post.id = liked.postId group by post.id`, function(err, result) { + db.query(`SELECT post.id, post.title, post.createdate, count(liked.id) 'count' + FROM (SELECT * FROM post WHERE post.userId=${request.user.id}) post left join liked + on post.id = liked.postId group by post.id`, function(err, result) { if (err) throw err; console.log(result) var list =''; console.log(result[0].createdate) for (var i = 0;i < result.length; i++) { list += ` - -
+
+

${result[i].title}

${request.user.nickname} | ${result[i].createdate}
+
-
- +
` } const body = boardlist.HOME(list, request.user);