CRM sql 查询

Posted

tags:

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

查询实体信息:

--查询实体信息,实体名称:account select * from MetadataSchema.Entity where name= ‘account‘

技术分享

查询窗体信息:

--查询窗体信息,ObjectTypeCode: 实体的code select * from systemform where ObjectTypeCode = 1

技术分享

查询视图信息:

--查询视图信息,ReturnedTypeCode:实体的code select * from SavedQuerybase where ReturnedTypeCode = 1

技术分享

 

查询字段信息:

--查询字段信息 with attr as(    select * from MetadataSchema.Attribute as a    where a.EntityId in (select entityid from MetadataSchema.Entity    where name = ‘new_member‘) and a.IsCustomField = 1 ) select a.attributeid,a.Name,label.Label,ty.Description, (select top 1 name from MetadataSchema.Entity where EntityId in ( select ship.ReferencedEntityId from MetadataSchema.Relationship as ship where ship.ReferencingAttributeId = a.AttributeId)) as ‘lookName‘ from attr as a inner join MetadataSchema.LocalizedLabel as label on a.attributeid = label.objectid inner join MetadataSchema.AttributeTypes as ty on a.AttributeTypeId = ty.AttributeTypeId where label.objectcolumnname = ‘DisplayName‘ and a.validforcreateapi = 1

技术分享

查询关系信息: select * from MetadataSchema.Relationship where ReferencingEntityId in (select top 1 entityid from MetadataSchema.Entity where name = ‘new_store‘)

技术分享

 

以上是关于CRM sql 查询的主要内容,如果未能解决你的问题,请参考以下文章

ssh框架开发crm(客户关系系统总结)

crm查询记录共享给了哪些人

SQL查询获得每个帐户的最新活动(有效查询)

sql优化个人总结(全)

如何提高 SQL Server 查询的性能 [关闭]

要计算的特定 SQL 查询 [重复]