Please try the great god teach a lot of methods have failed,

CodePudding user response:
Written in MSSQL, understanding thoughtThe test data
-If not object_id (N 'Tempdb for.. # T ') is null
Drop table # T
Go
The Create table # T (int [time], [fearture] nvarchar (21), [value] nvarchar (21))
Insert # T
Select 1, N 'A', N 'me' union all
Select 1, N 'B', N 'is' union all
Select 1, N 'C', N 'dong' union all
Select 2, N 'A', N 'British' union all
Select 2, N 'B', N 'jay' union all
Select 2, N 'C', N ', '
Go
- the end of the test data
SELECT [time],
MAX (CASE [fearture]
WHEN the 'A' THEN [value]
The ELSE NULL
END) Chinese,
MAX (CASE [fearture]
WHEN 'B' THEN [value]
The ELSE NULL
END) mathematics,
MAX (CASE [fearture]
WHEN the 'C' THEN [value]
The ELSE NULL
END) English
The FROM # T
GROUP BY [time]

CodePudding user response:
It was the conversion operation aTransformation of three methods
CodePudding user response:
Has been solved, thank you

CodePudding user response:
Characteristic this line if I have 200 different values, I want to write 200MAX (CASE... END) statement, simple method, excuse me?

CodePudding user response: