From 51aae1c2c9723006dc439c5448d61d416e039902 Mon Sep 17 00:00:00 2001 From: kimjihong9 Date: Fri, 19 May 2023 18:00:48 +0900 Subject: [PATCH] =?UTF-8?q?fix.=20getUserInfo=20sql=EB=AC=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/controllers/users.ctrl.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/controllers/users.ctrl.js b/backend/controllers/users.ctrl.js index b8cf2d0..1185d5a 100644 --- a/backend/controllers/users.ctrl.js +++ b/backend/controllers/users.ctrl.js @@ -24,10 +24,10 @@ const getUserInfo = (req, res) => { const { email } = req.body; db.query( - `SELECT COUNT(m.cost) as totalCount, SUM(m.cost) as totalCost, i.* + `SELECT COUNT(m.cost) as totalCount, IFNULL(SUM(m.cost), 0) as totalCost, i.* FROM member_rating AS m - JOIN member_info AS i ON m.user_id = i.id - WHERE i.id = ?; + RIGHT OUTER JOIN member_info AS i ON m.user_id = i.id + where i.id=?; `, [email], (error, result) => {