SELECT
champions.champ_name,
guides.guide_title,
members.member_username,
guides.guide_countview AS count_view,
(
SELECT COUNT(comments.comment_id)
FROM comments
WHERE guides.guide_id = comments.guide_id
)AS count_comment,
(
SELECT COUNT(like_guides.member_id)
FROM like_guides
WHERE guides.guide_id = like_guides.guide_id
)AS count_like
FROM guides
INNER JOIN champions ON guides.champ_id = champions.champ_id
INNER JOIN members ON guides.member_id = members.member_id
WHERE guides.guide_id = 1
result :
คืองี้ครับ...
ผมต้องการจะ SELECT ข้อมูลให้ได้ดังภาพครับ..
แต่ในขณะที่ SELECT ผมต้องการจะ UPDATE guides SET guides.guide_countview = guides.guide_countview+1 WHERE WHERE guides.guide_id = 1
(บรรทัดที่ 5)
แล้ว return guides.guide_countview AS count_view อ่ะครับ
SELECT
champions.champ_name,
guides.guide_title,
members.member_username,
(guides.guide_countview + 1) AS count_view,
(
SELECT COUNT(comments.comment_id)
FROM comments
WHERE guides.guide_id = comments.guide_id
)AS count_comment,
(
SELECT COUNT(like_guides.member_id)
FROM like_guides
WHERE guides.guide_id = like_guides.guide_id
)AS count_like
FROM guides
INNER JOIN champions ON guides.champ_id = champions.champ_id
INNER JOIN members ON guides.member_id = members.member_id
WHERE guides.guide_id = 1