我整理了我的问题的一个示例场景,我希望它足以让某人为我指明正确的方向。
我有两张桌子
产品
产品Meta
我需要以下内容的结果集
发布于 2010-04-01 05:12:53
如果您的数据库引擎是2005,并且数据库处于2000兼容模式,则可以通过从2005数据库运行查询来解决兼容性较低的模式。通过对查询中的表使用三部分命名约定(如DatabaseNameHere.dbo.TableNameHere
)来确定2000数据库的目标
发布于 2008-11-23 20:03:57
Select a.ProductId
,a.Name
,(Select c.MetaValue
From [Product Meta] c
Where c.ProductId = a.ProductId
And c.MetaKey = 'A') As 'A'
,(Select d.MetaValue
From [Product Meta] d
Where d.ProductId = a.ProductId
And d.MetaKey = 'B') As 'B'
,(Select e.MetaValue
From [Product Meta] e
Where e.ProductId = a.ProductId
And e.MetaKey = 'C') As 'C'
From Products a
Order By a.ProductId Asc
https://stackoverflow.com/questions/312861
复制相似问题