SQL如何编写查询同时满足多行条件的语句(有图)
发布网友
发布时间:2023-08-31 10:44
我来回答
共3个回答
热心网友
时间:2023-09-04 07:32
select cno,bno from borrow
where bno = 1
or bno = 2
如果还有其他条件的话,需要将or的条件括起来,这样才不会出错如
select cno,bno from borrow
where (bno = 1
or bno = 2)
and cno <> '1004'
或者
select cno,bno from borrow
where bno in('1','2')
热心网友
时间:2023-09-04 07:32
select cno,bno
from borrow
where bno in(1,2)
热心网友
时间:2023-09-04 07:33
Select * from borrow where cno in
(
Select cno from
(select distinct cno,bno from borrow where bno in ('1','2') ) as a group by cno having count(cno)>1
) as b