我正在做一个查询,它从表的行中获取数据并将其放在同一列下:
SELECT [t].*,
[d].[Description] AS [Name],
FROM [TrainerClass] AS [t] join [DescriptionTranslation] AS [d] on [t].[Code] = [d].[Code]
WHERE [d].[TableName] = 'TrainerClass' AND
[d].[FieldName] = 'Name' AND
[d].[Language] = 'en-EN';
这工作得很好,但它返回一个单列。我想用更多的列得到相同的结果,但我不知道如何使用 WHERE 语句来做到这一点。我想实现类似的目标:
SELECT [t].*,
[d].[Description] AS [Name] WHERE [d].[FieldName] = 'Name',
[d].[Description] AS [Info] WHERE [d].[FieldName] = 'Info',
FROM [TrainerClass] AS [t] join [DescriptionTranslation] AS [d] on [t].[Code] = [d].[Code]
WHERE [d].[TableName] = 'TrainerClass' AND
[d].[Language] = 'en-EN';
我知道这不是一个正确的语法,这就是我问你如何得到这个结果的原因。先感谢您 :)
编辑:
我不想要的:
我想要的是:
(仅以一条记录制作的示例,应该还有更多)