注册 登录
编程论坛 SQL Server论坛

显示错误,请大家指教

solution 发布于 2007-07-24 14:58, 515 次点击
请写出在class表中查找满足如下条件的记录的SQL语句:
1.返回字段 c_name,c_stu
2.返回记录数:前5条
3.查询条件:c_stu的值大于30,并且c_type值为真,并且c_name字段值中有"二班"二字.
4.查询结果:按c_stu正排序,按c_type倒排序(注正排序时请不要省略排序关键字)


我的答案如下:
select top 5 c_type,c_name,c_stu from class where c_type=true,like "二班",c_stu>30 order by c_type desc,c_stu asc

但是!
3 回复
#2
solution2007-07-24 15:01
知道错哪了.
正确答案如下:
SELECT TOP 5 c_name,c_stu FROM class WHERE c_stu>30 AND c_type=true AND c_name LIKE '*二班*' ORDER BY c_stu asc,c_type DESC
#3
uukkcc2007-07-24 18:58

哦.那我路过.

[此贴子已经被作者于2007-7-24 19:00:50编辑过]

#4
野蛮女人__2007-07-24 19:24
以下是引用uukkcc在2007-7-24 18:58:16的发言:

哦.那我路过.


1