问几条简单的SQL语句!

[复制链接]
查看11 | 回复2 | 2009-3-30 21:35:06 | 显示全部楼层 |阅读模式
1. sql="select top 1 * from news whereBigclassname='"&名一佳教&"'"
我想实现的是从表News中查询BIgclassname是"名一佳教"的第一条记录
名一佳教 是 文本类型的
可测试后发现是 有无效字符
2.如果查询 第2条到第10条纪录 怎样写
谢谢大家哦!
3. 如果再想实现
从表News中查询字段BIgclassname是"名一佳教" 和 字段OK是"TRUE"(数据类型-是/否) 的第一条记录
字段TRUE 数据类型是 是/否

回复

使用道具 举报

千问 | 2009-3-30 21:35:06 | 显示全部楼层
1、...where Bigclassname='名一佳教'就行了。2、select top 10 * from newswhere Bigclassname='名一佳教' and Bigclassname not in(select top 1 Bigclassname from news where Bigclassname='名一佳教')。可能有点复杂,期待简化的...
回复

使用道具 举报

千问 | 2009-3-30 21:35:06 | 显示全部楼层
1. sql="select top 1 * from news where Bigclassname='名一佳教'"2. sql="select top 9 * from (select top 10 * from news where Bigclassname='名一佳教' order by id desc) order by id desc"3...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行