【发布时间】:2014-04-07 11:29:42
【问题描述】:
我有以下查询从多个表中获取数据
SELECT TOP (100) PERCENT
dbo.tblProduct.PK AS PRODUCT_PK, dbo.tblProduct.PRODUCT_NAME,
dbo.tblProductSubComponent.SUB_COMPONENT_PK,
dbo.tblComponent.COMPONENT_NAME, dbo.tblSubComponent.SUB_COMPONENT_NAME
FROM
dbo.tblProductComponent
RIGHT OUTER JOIN
dbo.tblComponent
INNER JOIN
dbo.tblSubComponent
INNER JOIN
dbo.tblComponentSubComponent ON dbo.tblSubComponent.PK = dbo.tblComponentSubComponent.SUB_COMPONENT_PK
ON dbo.tblComponent.PK = dbo.tblComponentSubComponent.COMPONENT_PK
ON dbo.tblProductComponent.COMPONENT_PK = dbo.tblComponent.PK
LEFT OUTER JOIN
dbo.tblProductSubComponent ON dbo.tblSubComponent.PK = dbo.tblProductSubComponent.SUB_COMPONENT_PK
FULL OUTER JOIN
dbo.tblProduct ON dbo.tblProductSubComponent.PRODUCT_PK = dbo.tblProduct.PK AND dbo.tblProductComponent.PRODUCT_PK = dbo.tblProduct.PK
ORDER BY
PRODUCT_PK
结果是
现在我想像这样在gridview中显示数据
【问题讨论】:
标签: sql sql-server transpose