下面的 sql 语句(没有 if)返回 1 行,1 列 = 8。但是如果我在 SELECT 和 <. 我想要做的是,如果返回的测试为 true 的行数少于 50。如果返回 50 行,则返回 false。
谢谢您的帮助
IF SELECT COUNT([VDeck_ID]) FROM [SecondLifeDatabases].[dbo].[YuGiOh-Cards]
WHERE [User_ID] =
(SELECT [ID] FROM [SecondLifeDatabases].[dbo].[YuGiOh-Users]
WHERE [UUID] = 'D38C3475-C995-4EB2-85D0-F2A3ED1D23A0')
and [VDeck_ID] =
(SELECT [ID] FROM [SecondLifeDatabases].[dbo].[YuGiOh-VDecks]
WHERE [DeckName] = 'NewDeckName')
< 50
BEGIN
UPDATE [SecondLifeDatabases].[dbo].[YuGiOh-Cards]
SET [VDeck_ID] =
(SELECT [ID] FROM [SecondLifeDatabases].[dbo].[YuGiOh-VDecks]
WHERE [User_ID] =
(SELECT [ID] FROM [SecondLifeDatabases].[dbo].[YuGiOh-Users]
WHERE [UUID] = 'D38C3475-C995-4EB2-85D0-F2A3ED1D23A0')
and [DeckName] = 'NewDeckName')
WHERE [ID] = '11'
END