日期:2014-05-17 浏览次数:20830 次
CREATE PROCEDURE [quest].[UserQuests_Delete]
(
@UserId INT,
@QuestId INT
)
AS
BEGIN
SET NOCOUNT ON
DELETE FROM
quest.UserQuests
WHERE
UserId=@UserId AND
QuestId= @QuestId AND
UserQuestState=2 AND
UserQuestId<>(SELECT TOP 1 UserQuestId FROM quest.UserQuests WHERE UserId=@UserId AND QuestId= @QuestId AND UserQuestState=2 ORDER BY CreateDateUTC DESC)
DELETE FROM quest.UserQuests WHERE UserQuestState=3
END
SELECT?TOP?1?UserQuestId?FROM?quest.UserQuests?
SELECT?TOP?1?UserQuestId?FROM?quest.UserQuests?with(nolock)