我希望这是一个简单的问题。当SELECT
[Limit5].[Id] AS [Id],
[Limit5].[C1] AS [C1],
[Limit5].[C2] AS [C2]
FROM
(SELECT TOP (1)
[Project11].[Id] AS [Id],
CASE WHEN ([Project11].[C1] IS NOT NULL) THEN [Project11].[Name] END AS [C1],
CASE WHEN ([Project11].[C2] IS NOT NULL) THEN [Project11].[C3] ELSE 0 END AS [C2]
FROM
(SELECT
[Project9].[Id] AS [Id],
[Project9].[Name] AS [Name],
[Project9].[C1] AS [C1],
[Project9].[C2] AS [C2],
(SELECT TOP (1)
[Extent6].[PlayerId] AS [PlayerId]
FROM [dbo].[PlayerGameResult] AS [Extent6]
WHERE [Project9].[Id] = [Extent6].[PlayedGameId]) AS [C3]
FROM ( SELECT
[Project8].[Id] AS [Id],
[Project8].[Name] AS [Name],
[Project8].[C1] AS [C1],
[Project8].[C2] AS [C2]
FROM ( SELECT
[Project6].[Id] AS [Id],
[Project6].[Name] AS [Name],
[Project6].[C1] AS [C1],
(SELECT TOP (1)
[Extent5].[Id] AS [Id]
FROM [dbo].[PlayerGameResult] AS [Extent5]
WHERE [Project6].[Id] = [Extent5].[PlayedGameId]) AS [C2]
FROM ( SELECT
[Project5].[Id] AS [Id],
[Extent4].[Name] AS [Name],
[Project5].[C1] AS [C1]
FROM (SELECT
[Project3].[Id] AS [Id],
[Project3].[C1] AS [C1],
(SELECT TOP (1)
[Extent3].[PlayerId] AS [PlayerId]
FROM [dbo].[PlayerGameResult] AS [Extent3]
WHERE [Project3].[Id] = [Extent3].[PlayedGameId]) AS [C2]
FROM ( SELECT
[Project2].[Id] AS [Id],
[Project2].[C1] AS [C1]
FROM ( SELECT
[Extent1].[Id] AS [Id],
(SELECT TOP (1)
[Extent2].[Id] AS [Id]
FROM [dbo].[PlayerGameResult] AS [Extent2]
WHERE [Extent1].[Id] = [Extent2].[PlayedGameId]) AS [C1]
FROM [dbo].[PlayedGame] AS [Extent1]
WHERE [Extent1].[Id] = @p__linq__0
) AS [Project2]
) AS [Project3] ) AS [Project5]
LEFT OUTER JOIN [dbo].[Player] AS [Extent4] ON [Project5].[C2] = [Extent4].[Id]
) AS [Project6]
) AS [Project8]
) AS [Project9]
) AS [Project11]
) AS [Limit5]
等于某个条件时,我正在尝试建立Field1
的值。
例如
Field2
但无论出于何种原因,我都无法解决这个问题。有人可以帮忙吗?
答案 0 :(得分:2)
无需等号。
CASE WHEN Column1 IN ('118','119') THEN 0 ELSE Column2 END AS Column2
答案 1 :(得分:2)
您必须更改SELECT
:
CASE WHEN Column1 IN ('118','119') THEN 0 ELSE Column2 END AS Column2