我对此声明有疑问:
select *
from texts
where id in (1, 3)
and address in ('address_one', 'address_another');
Run Code Online (Sandbox Code Playgroud)
我想拥有满足这些条件的所有记录:
如果有办法做到这一点?
您需要重新编写WHERE子句,如下所示;
(id = 1 and address = 'address_one') or (id = 3 and address = 'address_other')
Run Code Online (Sandbox Code Playgroud)
另一种方法可能是;
(cast(id as varchar(32)) + '_' + address) in ('1_address_one', '3_address_other')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
52 次 |
| 最近记录: |