注册 登录
编程论坛 PowerBuilder

急,请教一个问题??

cobi_xiao 发布于 2007-09-11 07:25, 1776 次点击
select calling_nbr,sum(balance)/100 from bill.prepay_php_call_ticket_08
where bureau_code_c4='MY' and (不知道如何写)end_time
group by calling_nbr;
注释:在bill.prepay_php_call_ticket_08表中,字段calling_nbr有很多相同的号码,每个号码我只要求取
当字段end_time下的值为这个号码的最大值时取该号码对应字段balancer的值!
3 回复
#2
gugu07922007-09-12 18:57
select calling_nbr,sum(balance)/100 from bill.prepay_php_call_ticket_08
where bureau_code_c4='MY' and calling_nbr in (select calling_nbr,sum(end_time) from bill.prepay_php_call_ticket_08 group by calling_nbr)


---------------
Over 拉
#3
西风独自凉2007-09-12 19:09
select calling_nbr,sum(balance)/100 from 表
where bureau_code_c4='MY'
and
calling_nbr in (select calling_nbr,max(end_time) from 表 group by calling_nbr)

[此贴子已经被作者于2007-9-12 19:16:10编辑过]

#4
tangchangxin2007-09-17 23:08

晕要你要实现什么功能啊,最大值用max去试一下吗?

1