SQL取出某列最大值的所有记录(行)的一种方法:select count(*) from tb where c > a.c
来源:互联网 发布:java泛型的使用 编辑:程序博客网 时间:2024/05/16 03:08
表tb
A B C
------------
1 2 2
1 2 3
1 2 4
2 2 4
3 2 4
c列为最大时的结果集:
1 2 4
2 2 4
3 2 4
有多种方法,其中有:
select a.* from tb a where 1 > (select count(*) from tb where c > a.c )
该语句(select count(*) from tb where c > a.c )是智能执行的,结果应该是3种情况:
当a.c=2时,count(*) =4;
当a.c=3时,count(*) =3;
当a.c=4时,count(*) =0
- SQL取出某列最大值的所有记录(行)的一种方法:select count(*) from tb where c > a.c
- [VB.NET]VB2005+ACCESS中,如何获得select count(1) from tb的返回值?
- C#: from in select ; m(linq where)
- sql语句:取按a列分组后,b列最大,的所有列的记录
- Sql语句的应用之 select * from tb p="" order by py order by
- SELECT count(ID) FROM LM_Photos WHERE (userid = @userid) 报错的原因
- mysql存储过程中使用select count(*) into 变量名 from +表+ where条件的用法
- SQL的 SELECT 字段 FROM 表 WHERE 某字段 Like 条件
- C$ sql:select * from 表名 where 条件:表名和条件是字符串时
- oracle 查找行记录最大值和最大值的列名
- 批次查找策略select * from 存取顺序找到的批次表table where 选择条件B sort by 排序C
- select * from 与select count(*) from 的区别
- Select count(*) from与Select * from的区别
- > --3. 可以在主查询的where select from having后面放置子查询 SQL> select empno,ename,(select job from emp where emp
- 实用的SQL函数(用于将符合条件的某列所有记录合成一行)
- SQL取出第 m 条到第 n 条记录的方法
- SQL取出第 m 条到第 n 条记录的方法
- String sql = "select * from sys_user where 1=2"与String sql = "select * from sys_user where 1=1的对比介绍
- master..spt_values表
- Ogre中SceneManager分析
- NFS服务器配置-服务启动与停止
- MaterialSystem分析
- Swing事件处理
- SQL取出某列最大值的所有记录(行)的一种方法:select count(*) from tb where c > a.c
- 祝大家虎年龙腾虎跃,事业成就,学习猛进
- CVE-2006-2607 Jobs start from root when pam_limits
- 存储过程的学习(转帖)
- ADROID 2.1 架构解析 3 亮度设置
- HTTP请求和响应。
- post和get方式发送数据
- WPARAM与LPARAM的区别
- 面向对象