output the result of a stored procedure

you can assign the variables directly in your select statement like so:

 SELECT TOP 1 @foodName= TD.FoodName, @OrderCount =SUM(TD.Number) 
    
    FROM tblFactor
    INNER JOIN tblDetail TD 
    ON tblFactor.Factor_ID = TD.Factor_ID
    WHERE FactorDate = @DayDate
    GROUP BY TD.FoodName
    ORDER BY SUM(TD.Number) DESC

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top