假设我有两个表:
Person
- Id
- Name
PersonAttribute
- Id
- PersonId
- Name
- Value
假设每个人都有两个属性(比如性别和年龄),一个样本记录可能是这样的:
Person->Id = 1
Person->Name = 'John Doe'
PersonAttribute->Id = 1
PersonAttribute->PersonId = 1
PersonAttribute->Name = 'Gender'
PersonAttribute->Value = 'Male'
PersonAttribute->Id = 2
PersonAttribute->PersonId = 1
PersonAttribute->Name = 'Age'
PersonAttribute->Value = '30'
问题:如何查询以获得以下结果:
'约翰·多', '男', '30'