我无法找到查询。SQL查询Where子句问题
我有一个表'NotificationExcludes',其中包含1列'名称'。
我有一个表'NotificationEvents',其中包含列:Id,说明。
现在我需要选择所有NotificationEvents,其中描述不是以'NotificationExcludes'中包含的值开始的。
小例子:
NotificationExcludes包含:
Name
The instance was terminated by
NotificationEvents:
ID Description
1 There was a failure on ..
2 The instance was terminated by administrator
现在我需要除非描述与被保存在一个数值开始选择一切“ NotificationExcludes'。
我已经试过
Select Id, Description
from NotificationEvent
WHERE Description NOT IN (select Name form NotificationExcludes)
但2个问题与:
1 The query obviously fails because 'select Name form NotificationExcludes' returns more than 1 record
2 The statement should contain a Like statement where I can use the '%' key. So where description not like 'The instance was terminated by%' can be used somehow
我想你会需要这个光标。您的代码是否在存储过程中? – 2011-03-17 13:31:16