开发者

Grouped results with SQL Server Stored Procedures

Is it possible to generate results as shown in the at开发者_如何学Gotachment using SQL server 2008 Stored Procedures?

Grouped results with SQL Server Stored Procedures


you can user a SELECT to have what you showed:

SELECT vendor,
       category,
       sub_category,
       product,
       price,
       vendor_name
  FROM (
SELECT          vendor AS ID,
                NULL AS vendor,
                category,
                sub_category,
                product,
                price,
                vendor_name
  FROM table
UNION ALL
SELECT DISTINCT vendor AS ID,
                vendor,
                NULL AS category,
                NULL AS sub_category,
                NULL AS product,
                NULL AS price,
                NULL AS vendor_name
  FROM table
) T
ORDER BY ID, category
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜