我有以下查询。它给了我一个错误“列 'Sites.IsMobileSite' 在选择列表中无效,因为它不包含在聚合函数或 GROUP BY 子句中。” 对于以下 sql 代码 -
select max(rc.[name]) [Reseller], max(c.[name]) [Customer],
case
when max(c.[Url]) is not null then max(c.[URL])
else 'NA'
end[URL],
case
when max(s.[Domain]) is not null then max(s.[Domain])
else 'NA'
end[Site Name],
case
when (s.[IsMobileSite]) = 0 then 'No'
else 'Yes'
end [Is Mobile Site],
case
when max(s.[CreatedDate]) is not null then max(s. [CreatedDate])
end[Created Date]
from customers c with(nolock)
left outer join Sites s with(nolock) on c.CustomerId = s.CustomerId
left outer join customers rc on rc.CustomerId = c.ResellerId
where c.[name] is not null
and ( c.customerId is null or rc.CustomerId = c.CustomerId)
and c.IsActive !=''