select dt . DisplayName as [类显示名]
,a .id as [字段定义 Base_DescFlexSegment_ID] ,a .Number as [段号] ,at. Name as [段名称]
,b. id as [Base_DescFlexContext_ID 上下文集合], bt.name as [上下文名称]
, e .id as [值集 Base_ValueSetDef_ID] ,e .code as [值集编码] ,et .Name as [值集名称]
,c. id as [上下文相关 Base_DescFlexFieldDef_ID],c .IsContextSensitive as [上下文相关] ,c. IsContextOverride as [上下文可改]
from Base_DescFlexSegment a
left outer join Base_DescFlexSegment_Trl at on a.id =at. id and at. SysMLFlag=‘zh-cn‘
left outer join Base_DescFlexContext b on a.DescFlexContext =b .id
left outer join Base_DescFlexContext_Trl bt on b.id =bt. id and bt. SysMLFlag=‘zh-cn‘
left outer join Base_DescFlexFieldDef c on b.DescFlexFieldDef =c .id
left outer join UBF_MD_Class d on c.EntityType =d . Local_ID
left outer join UBF_MD_Class_Trl dt on d.Local_ID =dt . Local_ID and dt. SysMLFlag=‘zh-cn‘
left outer join Base_ValueSetDef e on a.ValueSetDef =e . ID
left outer join Base_ValueSetDef_Trl et on e.id =et . id and et. SysMLFlag=‘zh-cn‘
where dt .DisplayName = ‘客户‘
order by b. ContextValue,a .number
用法:
select * from Base_ValueSetDef where id=1001609280001529 --企业规模
select * from Base_ValueSetDef where id=1001609280001206 --厂房或办公地点
select A.[ID], A.[Code], A1.[Name], A.[DependantCode] from Base_DefineValue as A left join [Base_DefineValue_Trl] as A1 on (A1.SysMlFlag = ‘zh-CN‘) and (A.[ID] = A1.[ID]) where (A.[ValueSetDef] = 1001609280001529) and code=‘SP03‘
select A.[ID], A.[Code], A1.[Name], A.[DependantCode] from Base_DefineValue as A left join [Base_DefineValue_Trl] as A1 on (A1.SysMlFlag = ‘zh-CN‘) and (A.[ID] = A1.[ID]) where (A.[ValueSetDef] = 1001609280001206)
--查看指定值集的值集值定义
select a .ID, a.ValueSetDef , a .Code, at.Name
from Base_DefineValue a
left outer join Base_DefineValue_Trl at on a.id =at. id and at. SysMLFlag=‘zh-cn‘
where ValueSetDef =1001307180000293