当前位置:Gxlcms > 数据库问题 > SQL 计算表A字段在表B字段中出现的次数

SQL 计算表A字段在表B字段中出现的次数

时间:2021-07-01 10:21:17 帮助过:64人阅读

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

SQL 计算表A字段在表B字段中出现的次数

标签:tps   etl   出现   live   rom   nbsp   group by   question   条件   

人气教程排行