我有两张桌子:
Table 1: contest_video
Table Rows: cv_id, uid, cid, cn_id, video_name, video_detail, video, image, cverify, date
Table 2: contest_vote
Table Rows: vid, cv_id, voter_id, date
现在我想加入这两个表,这将与计数。喜欢一个视频的总票数(vid)(视频名称)
我试过这样:
SELECT *
FROM (`contest_video`)
LEFT JOIN `system_user`
ON `system_user`.`id` = `contest_video`.`uid`
LEFT JOIN `contest_vote`
ON `contest_vote`.`cv_id` = `contest_video`.`cv_id`
WHERE `contest_video`.`cid` = '1'
ORDER BY `contest_video`.`created_date` DESC
但它只返回数据而不计算。请需要专家帮忙。