|
|
@@ -1,6 +1,7 @@
|
|
|
-select sum(t1.count)as fcount from tlive_usercount t1
|
|
|
-inner join (
|
|
|
- select t1.channelid, max(time) as time from tlive t1
|
|
|
- inner join tlive_usercount t2 on t1.channelid = t2.channelid
|
|
|
- where t1.livestatus = 'live'
|
|
|
- ) t2 on t1.channelid = t2.channelid and t1.time = t2.time
|
|
|
+select channelid,tagentsid,t.fbrand,t.fprodclassname,count as fcount,t.channelcoverimageurl from (
|
|
|
+select ROW_NUMBER()over(partition by t1.channelid order by t1.time desc)as num,t1.channelid,t2.tagentsid,t1.count,t2.channelcoverimageurl,
|
|
|
+t3.fbrand,(stuff((select ',' + fprodclassname from tagents_prodclass where siteid = t3.siteid and tagentsid=t3.tagentsid for xml path('')),1,1,'')) as fprodclassname
|
|
|
+from tlive_usercount t1
|
|
|
+inner join tlive t2 on t1.channelid=t2.channelid --and t2.livestatus='live'
|
|
|
+inner join tagents t3 on t2.siteid=t3.siteid and t2.tagentsid=t3.tagentsid
|
|
|
+)t where t.num=1
|