English 中文(简体)
如何计算每个父母的子类别?
原标题:How to get the item count for sub-categories on each parent?
  • 时间:2009-10-27 21:49:17
  •  标签:

与以下员额有关:

The function that retrieves the item counts for each folder (category) is:

ALTER FUNCTION [dbo].[GetFolderReceiptCount]
(
    -- Add the parameters for the function here
    @FolderID bigint
)
RETURNS int
AS
BEGIN

    DECLARE @Return int

    SET @Return = 0

    SELECT 
        --H.ReceiptFolderID, 
        @Return = COUNT(H.ReceiptFolderID)
    FROM
        tbl_ReceiptFolderLnk H
        JOIN tbl_Receipt D ON H.ReceiptID = D.ReceiptID
    WHERE ReceiptFolderID=@FolderID
    GROUP BY
        H.ReceiptFolderID

    -- Return the result of the function
    RETURN @Return      

END

如何改变这种状况,以换取父母的报酬?

最佳回答

您应改变职能,以收回表格变量,或采用储存程序,使您能够获取数据集。

《康乐声明》应类似:

SELECT 
    H.ReceiptFolderID, COUNT(H.ReceiptFolderID)
FROM
    tbl_ReceiptFolderLnk H
    JOIN tbl_Receipt D ON H.ReceiptID = D.ReceiptID
WHERE ReceiptFolderID=@FolderID
GROUP BY
    H.ReceiptFolderID
问题回答

暂无回答




相关问题
热门标签