ORACLE 取最大值
表字段
ID NAME TIME AMOUNT
14502 1111 0201 1
14502 1111 0201 5
14502 2222 0201 4
14502 1111 0201 2
14502 2222 0201 3
14502 1111 0201 2
14502 2222 0201 5
14502 1111 0201 2
14502 1111 0202 3
14502 1111 0202 1
14502 1111 0202 2
想取出不同的ID NAME TIME 的最大的AMOUNT值。
即
ID NAME TIME AMOUNT
14502 1111 0201 5
14502 2222 0201 5
14502 1111 0202 3
可是我写的句子
max group by 不对
max partition by 也不对、、
谢谢帮助~!
select ID, NAME ,TIME,max(amount) amount
from table
group by ID, NAME ,TIME
with test as
(
select 14502 a, 1111 b, '0201' c, 1 d from dual
union al
相关问答:
能否用语句实现。而不是现成的工具?
楼上的兄弟可以详细一些吗?
祝你节日快乐!哈哈
节日快乐
SQL code:
一. 导出工具 exp
1. 它是操作系统下一个可执行的文件 存放目录/ORACLE_HOME/bin
......
手头有一个老的产品,delphi 6连接oracle,取sys.aud$系统表里面的数据
用Adoconnection+adodataset,
用system用户,Adoconnection 连接成功,但如果在adodataset里面写:
SELECT * from SYS.AUD ......
在Eclipse里编写的一个JAVA程序,连接数据库,却总连不上,程序为:
import java.sql.*;
public class as {
public static void main(String args[])throws Exception
{
Class.forName("oracle. ......
with adod_dict do
begin
close;
commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......