How can I loop through a table within a stored procedure?
问题 This question evolved from this one. I have two tables that I need to query and glean some calculated sums from; I need a result set based on units -- one row for each Unit, with calculated data for them folded into that row. The two tables contain the following pertinent members: CustomerCategoryLog : Unit varchar(25) MemberNo varchar(10) Category varchar(50) Subcategory varchar(50) BeginDate Datetime EndDate Datetime ReportingMonthlySales : Unit (VarChar) MemberNo (VarChar) MonthlySales