首先,这里是 sp_GetWorkQByUserName 的代码:
ALTER PROCEDURE [dbo].[sp_GetWorkQByUserName]
( @UserName varchar(50),
@StartDate datetime,
@EndDate datetime )
AS
BEGIN
SET NOCOUNT ON;
SELECT DISTINCT SpotId FROM tblSpotCount WHERE StoreNum = EXECUTE sp_GetUserLocationCodes(@UserName)
ORDER BY SpotDt ASC
END
我知道我的SELECT DISTINCT
陈述是错误的,但我这样写是为了帮助展示我正在尝试做的事情。我想根据sp_GetUserLocationCodes
带有参数的结果运行这个存储过程@UserName
。
据我所知,我的问题在于我如何打电话sp_GetUserLocationCodes
。
问题:如何根据存储过程的结果运行SELECT DISTINCT
查询?tblSpotCount.SpotId
sp_GetUserLocationCodes