开发者

Sorting a table using a subrepot column in SSRS. Is this possible?

I'm using SSRS 2005. I've got a table with various inventory data. In one columns I've got a subreport that is designed to pull the da开发者_如何学Pythonte of the most recent Purchase Order based upon the product code of whichever row the subreport is in. This would be fine, however I'm now being asked to be able to sort by this date column. My assumption is that you cannot sort a column with a subreport in it, but I thought I'd ask. Is there any way to do this?


You can include the most recent purchase order value in your main report's dataset as a subquery like this:

SELECT *
,(SELECT TOP 1 PurchaseOrder 
    FROM Purchasing p 
    WHERE p.ProductCode = i.ProductCode 
    ORDER BY PurchaseDate DESC
 ) as LastPurchaseOrder
FROM Inventory

Then you can use that value to sort your table.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜