sql 中如何查询一个字段符合两个条件

例如:在book表中查询bno 满足借了书1没借书2的读者

sql中如何查询一个字段符合两个条件的方法。

如下参考:

1.在计算机中,打开Foxtable软件,新建一个表格,如学生评价结果,并输入数据,如下图所示。

2.然后,鼠标左键单击单键攻击菜单下选择[杂项],如下图所示。

3.然后,在菜单列中,左键单击[SQLquery],如下图所示。

4.接下来,在[SQLquery]窗口中选择数据源,如下图所示。

5.然后,在[SQLquery]窗口中,输入SQL查询语句,如下图所示。

6.接下来,在表的预览中,您可以看到通过查询语句显示的数据,如下图所示。

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-09-01
可用where...and语句。
如student表数据:
classid name age
1 张三 19
1 李四 20
1 王五 20
2 赵六 18
2 孙七 21
2 杨八 19

如果要查classid为1且age为20的人的信息,可用如下语句:
select * from student where classid=1 and age=20
结果就是:
classid name age
1 李四 20
1 王五 20
select * from student where classid=1 and age=20
第2个回答  2019-06-13
select * from user where name='张三' and name ='李四'
select * from user where name in ('张三','李四');

分析:

    增加关系表,人员借书信息表。

    在book表中增加借书标记字段。

    条件合适后,查询很方便了。欢迎追问,谢谢采纳!

第3个回答  推荐于2017-09-28
select t1.bno from
(select bno from book where 书名='书1') as t1,
(select bno from book where 书名<>'书2') as t2
where t1.bno=t2.bno

本回答被提问者和网友采纳
第4个回答  2013-09-09
select bno from book where 条件 = 书1 and 条件 <> 书2追问

不行,试过了

追答

你把字段名称,字段的内存发出来