sql 队列强盗

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 队列强盗相关的知识,希望对你有一定的参考价值。

select top(20) t.QUEUENAME, t.NAME as TERMINAL, COUNT(t.SYSID) TERMINAL_Q_EVENTCOUNT from 
(select top 30000 rt.NAME, rte.CREATEDTIME, rte.SYSID, QUEUENAME from TBListEntry le
inner join TBRemoteTerminalEvent rte on rte.SYSID = le.VALUESYSID
inner join TBRemoteTerminal rt on rt.SYSID = rte.OIDTERMINAL
--where QUEUENAME  in ('FalcomTerminalMQ#6104','FalcomTerminalMQ','TrakM8TEDSTerminalMQ','TeltonikaTerminalMQ')
)t
group by t.QUEUENAME, t.NAME
order by TERMINAL_Q_EVENTCOUNT desc

select top(20) QUEUENAME, c.ID as COMMUNICATOR, COUNT(c.SYSID) COMMUNICATOR_Q_EVENTCOUNT from 
(select top 30000 QUEUENAME, comm.ID, ce.CREATEDTIME, ce.SYSID from TBListEntry le
inner join TBRemoteCommunicatorEvent ce on ce.SYSID = le.VALUESYSID
inner join TBRemoteCommunicator comm on comm.SYSID = ce.OIDCOMMUNICATOR
where QUEUENAME in ('FalcomCommunicatorMQ','TrakM8TEDSCommunicatorMQ','TeltonikaCommunicatorMQ')
)c
group by c.QUEUENAME,c.ID
order by COMMUNICATOR_Q_EVENTCOUNT desc

select top(20) neQuery.QUEUENAME, neQuery.TERMINAL_ID as TERMINAL_ID, count(neQuery.TERMINAL_ID) as NETWORK_Q_EVENTCOUNT from
(select  le.QUEUENAME, ne.*, xdata.PARTNUMBER, 
	case QUEUENAME when 'ROAMWORKSInTeltonikaGPRSQ' then substring(cast(xdata.XMLCHUNK as XML).value('(/sourceData/rawCommunication)[1]','varchar(2000)'), 0, 32) 
		else substring(cast(xdata.XMLCHUNK as XML).value('(/sourceData/rawCommunication)[1]','varchar(2000)'), 0, 16) end as TERMINAL_ID from dbo.TBListEntry le
	inner join dbo.TBNetworkEvent ne on le.VALUESYSID = ne.SYSID
	inner join dbo.TBXmlData xdata on xdata.OIDOWNER = ne.SYSID
where le.QUEUENAME like '%In%') neQuery
group by neQuery.QUEUENAME,neQuery.TERMINAL_ID
order by NETWORK_Q_EVENTCOUNT desc


select le.QUEUENAME, cast(xdata.XMLCHUNK as XML).value('(/sourceData/rawCommunication)[1]','varchar(2000)') 
from TBListEntry le, TBNetworkEvent ne, TBXmlData xdata
where le.VALUESYSID = ne.SYSID
and xdata.OIDOWNER = ne.SYSID

select *  from TBListEntry le, TBNetworkEvent ne, TBXmlData xdata
where le.VALUESYSID = ne.SYSID
and xdata.OIDOWNER = ne.SYSID


select top(20) neQuery.QUEUENAME, neQuery.TERMINAL_ID as TERMINAL_ID, count(neQuery.TERMINAL_ID) as NETWORK_Q_EVENTCOUNT from
(select  le.QUEUENAME, ne.*, xdata.PARTNUMBER, 
	cast(xdata.XMLCHUNK as XML).value('(/sourceData/rawCommunication)[1]','varchar(2000)') as TERMINAL_ID from dbo.TBListEntry le
	inner join dbo.TBNetworkEvent ne on le.VALUESYSID = ne.SYSID
	inner join dbo.TBXmlData xdata on xdata.OIDOWNER = ne.SYSID
where le.QUEUENAME in ( 'ROAMWORKSInTeltonikaGPRSQ')) neQuery
group by neQuery.QUEUENAME,neQuery.TERMINAL_ID
order by NETWORK_Q_EVENTCOUNT desc

以上是关于sql 队列强盗的主要内容,如果未能解决你的问题,请参考以下文章

多臂强盗:当随机概率低于分配给强盗的成功概率时,为什么我们将奖励增加1

动态规划(斐波那契系列)---强盗抢劫

使用 Vowpal wabbit 的上下文强盗

Codevs2597团伙

强盗战争游戏,正确的命令但权限被拒绝?

P1892 [BOI2003]团伙 并查集