有关SQL语句的小问题

来源:百度知道 编辑:UC知道 时间:2024/05/23 22:32:44
请大家帮我下
要查询class表中字段c_stu值大于50,或小于20的纪录,并只返回c_name和c_stu字段,如何写SQL语句?
我这样写的
select c_name,c_stu from class where c_stu>50 or c_stu<20
显示错的,哪位高手能指点下,谢谢!

语句没错
看看是不是其他地方有问题
或者你把错误代码发上来
顺便问一下,你c_stu数据是什么类型的?

select c_name,c_stu
from class
where c_stu not in(select c_stu from class where c_stu between 20 and 50)