Select
c.name, c.number, f.Telephone3 As 'Phone Number',
(Select Value
from UserDefinedFieldLinks
where UserDefinedFieldID = 134) AS 'Referal Name',
(Select Value
from UserDefinedFieldLinks
where UserDefinedFieldID = 135) AS 'Referal Acc No.',
(Select Value
from UserDefinedFieldLinks
where UserDefinedFieldID = 137) AS 'Referal Phone No.',
udl.value as Answer
From
Customer C
Join
UserDefinedFieldLinks udl on udl.CustomerID = C.CustomerID
Join
UserDefinedFields d on udl.UserDefinedFieldID = d.UserDefinedFieldID
Join
UserDefinedFieldGroup e on d.UserDefinedFieldGroupID = e.UserDefinedFieldGroupID
Join
person f on C.CustomerID = f.PersonID
Where
e.UserDefinedFieldGroupID = 10
答案 0 :(得分:0)
下面之一是返回多个值,这意味着UserDefinedFieldID不是唯一的:
(Select Max(Value) from UserDefinedFieldLinks where UserDefinedFieldID = 135)
如果每个UserDefinedFieldID(未规范化)的值重复,那么您可以使用:
:not