当前线上观众人数查询.sql 490 B

12345678
  1. select channelid,tagentsid,t.fbrand,t.saleprodclass,count as fcount,t.channelcoverimageurl from (
  2. select ROW_NUMBER()over(partition by t1.channelid order by t1.time desc)as num,t1.channelid,t2.tagentsid,t1.count,t2.channelcoverimageurl,
  3. t3.fbrand,t3.saleprodclass
  4. from tlive_usercount t1
  5. inner join tlive t2 on t1.channelid=t2.channelid --and t2.livestatus='live'
  6. inner join tagents t3 on t2.siteid=t3.siteid and t2.tagentsid=t3.tagentsid
  7. where t2.tactivityid=$tactivityid$
  8. )t where t.num=1