当前位置: 代码迷 >> Sql Server >> 请教 这个SQl 语句如何写
  详细解决方案

请教 这个SQl 语句如何写

热度:32   发布时间:2016-04-25 00:56:07.0
请问 这个SQl 语句怎么写
请看:
------最佳解决方案--------------------
试试:

 SELECT  videotype ,
         COUNT(1) 总数
 FROM    userplaysongdata a
         INNER JOIN songlistdata b ON a.sourcefilename = b.sourcefilename
 GROUP BY videotype
 
------其他解决方案--------------------
我是这么写的  select videotype,count(*) sum from songlistdata where sourcefilename in (select  sourcefilename from userplaysongdata)group by videotype;

但是因为userplaysongdata 里面有很多相同的sourcefilename  所以 这样只统计了一次  不对 不知道怎么写 跪求告手
  相关解决方案