我尝试使用 SQL 语句和 NORTHWIND 数据库获取此输出:
Employee Name:Nancy Davolio
Number of Sales:345
Total Sales:192107.60
Employee Name:Andrew Fuller
Number of Sales:241
Total Sales:166537.75
Employee Name:Janet Leverling
Number of Sales:321
Total Sales:202812.84
Employee Name:Margaret Peacock
Number of Sales:420
Total Sales:232890.85
Employee Name:Steven Buchanan
Number of Sales:117
Total Sales:68792.28
Run Code Online (Sandbox Code Playgroud)
...还有 4 个条目
当我使用这个语句时:
USE Northwind
DECLARE @EmployeeName VARCHAR(40),
@NumberOfSales INT,
@TotalSales DECIMAL(10,2),
@Counter TINYINT = 1,
@NumEmployees INT = IDENT_CURRENT('dbo.Employees');
WHILE @Counter < @NumEmployees
BEGIN
--SELECT @EmployeeName = E.FirstName+' '+E.LastName
--SELECT @NumberOfSales = count(od.OrderID) …Run Code Online (Sandbox Code Playgroud)