吹风机松下负离子差别:asp 代码

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/04 19:13:52
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
这段代码有什么错能帮我看西鞍马
是Microsoft Assesas数据库,原题目是这样: 请写出在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_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

1、二班应该是单引号而不是双引号:
精确查询:'二班'
模糊查询:'%二班%'
2、如果是sql数据库,c_type如果是字符串类型,应该加上单引号,如果是bit类型,应该是1而不是true

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

这样就行了