经典的子查询
来源:互联网 发布:域名能卖多少钱 编辑:程序博客网 时间:2024/04/30 23:07
13、说明:一条sql 语句搞定数据库分页
select top 10 b.* from (select top 20 主键字段,排序字段 from 表名 order by 排序字段 desc) a,表名 b where b.主键字段 = a.主键字段 order by a.排序字段
14、说明:前10条记录
select top 10 * form table1 where 范围
15、说明:选择在每一组b值相同的数据中对应的a最大的记录的所有信息(类似这样的用法可以用于论坛每月排行榜,每月热销产品分析,按科目成绩排名,等等.)
select a,b,c from tablename ta where a=(select max(a) from tablename tb where tb.b=ta.b)
16、说明:包括所有在 TableA 中但不在 TableB和TableC 中的行并消除所有重复行而派生出一个结果表
(select a from tableA ) except (select a from tableB) except (select a from tableC)
17、说明:随机取出10条数据
select top 10 * from tablename order by newid()
18、说明:随机选择记录
select newid()
select top 10 b.* from (select top 20 主键字段,排序字段 from 表名 order by 排序字段 desc) a,表名 b where b.主键字段 = a.主键字段 order by a.排序字段
14、说明:前10条记录
select top 10 * form table1 where 范围
15、说明:选择在每一组b值相同的数据中对应的a最大的记录的所有信息(类似这样的用法可以用于论坛每月排行榜,每月热销产品分析,按科目成绩排名,等等.)
select a,b,c from tablename ta where a=(select max(a) from tablename tb where tb.b=ta.b)
16、说明:包括所有在 TableA 中但不在 TableB和TableC 中的行并消除所有重复行而派生出一个结果表
(select a from tableA ) except (select a from tableB) except (select a from tableC)
17、说明:随机取出10条数据
select top 10 * from tablename order by newid()
18、说明:随机选择记录
select newid()
- 经典的子查询
- 经典的标量子查询
- 帮盖尔优化SQL-----子查询优化的经典案例
- SQL经典---子查询和高级查询
- SQL优化经典----子查询优化
- 子查询的基本特征:
- 绝妙的子查询
- 子查询的基本特征:
- 子查询的应用
- 子查询的使用
- 数据库的子查询
- 子查询的知识点
- SQL的子查询
- 子查询的分类
- SQL的子查询
- 相关查询的子查询和嵌套子查询
- 经典SQL学习笔记 (四)-子查询
- 子查询,原来可以这样子的
- 使用动态解析设置vpn
- 好久没推荐文章了
- C#下实现双缓冲描画高频曲线(GDI+结合GDI)
- Cannot access NLS data files问题的解决办法
- 正则表达式判断收藏
- 经典的子查询
- UVa Problem Solution: 10142 - Australian Voting
- 批处理文件bat 语法备忘
- 优先级问题。
- 一道JAVA题的解决
- 学术资料账号密码全集汇总(转)
- 一直以来伴随我的一些学习习惯(part1)
- 一直以来伴随我的一些学习习惯(part2)
- 多国语言,国际化开发需求分析