Lync Server 2013 的示例持久聊天数据库查询
上次修改的主题: 2012-10-06
本部分包含持久聊天数据库的示例查询。
使用以下示例获取特定日期后最活跃的持久聊天室的列表。
SELECT nodeName as ChatRoom, COUNT(*) as ChatMessages
FROM tblChat, tblNode
WHERE channelId = nodeID AND dbo.fnTicksToDate(chatDate) > '1/1/2011'
GROUP BY nodeName
ORDER BY ChatMessages DESC
使用以下示例获取特定日期后最活跃用户的列表。
SELECT prinName as Name, count(*) as ChatMessages
FROM tblChat, tblPrincipal
WHERE prinID = userId AND dbo.fnTicksToDate(chatDate) > '1/1/2011'
GROUP BY prinName
ORDER BY ChatMessages DESC
使用以下示例获取发送消息的所有人的列表,其中包含“Hello World”。
SELECT nodeName as ChatRoom, prinName as Name, content as Message
FROM tblChat, tblNode, tblPrincipal
WHERE channelId = nodeID AND userId = prinID AND content like '%Hello World%'
使用以下示例获取特定主体的组成员身份列表。
SELECT prinName as Name
FROM tblPrincipalAffiliations as pa, tblPrincipal
where principalID = 7 and affiliationID = prinID
使用以下示例获取用户 Jane Dow 是其直接成员的每个聊天室的列表。
SELECT DISTINCT nodeName as ChatRoom, prinName as Name
FROM tblPrincipalRole, tblPrincipal, tblNode
WHERE prinRoleNodeID = nodeID AND prinRolePrinID = prinID AND prinName = 'Jane Dow'
使用以下示例获取用户收到的邀请列表。
SELECT prinName
,nodeName
,invID
,createdOn
FROM tblPrincipalInvites as inv, tblPrincipal as p, tblNode as n
where inv.prinID = 5 AND inv.prinID = p.prinID and inv.nodeID = n.nodeID
ORDER BY invID DESC