我有两列
<表类>
存储代码 tbody><<tr>Store1。DD 101 Store2。德 103 Store2。DD 103 Store1。DD 105 Store2。DD 107 表类>
SELECT [Store]
,[Code]
FROM [dbo].[Store]
WHERE not (Store like '%DD' and Code in ('101', '103'))
在您给出的示例中,您可以将逻辑从AND
更改为OR
SELECT * FROM table
WHERE Code NOT IN (101,103) OR Store NOT LIKE '%DD'
SELECT * FROM table
WHERE Store NOT LIKE '%DD' OR Code NOT IN ('101', '103')