SQL 计算表A字段在表B字段中出现的次数
时间:2020-03-31 09:43:53
收藏:0
阅读:104
SELECT A.Id,A.Name,COUNT(B.LiveID) AS count from SetLiveHistory B RIGHT JOIN Live A ON B.LiveId=A.Id GROUP BY A.Id,A.Name ORDER BY count;
附加条件:
select A.Id,A.Name,COUNT(B.LiveID) as count from
(select * from SetLiveHistory where time >= ‘2020-03-1‘) B
right join Live A ON B.LiveId=A.Id group by A.Id,A.Name order by count;
https://ask.csdn.net/questions/749402
原文:https://www.cnblogs.com/wintertone/p/12602479.html
评论(0)