Monday, 15 April 2013

how to select two max function in oracle -



how to select two max function in oracle -

i need select max 2 table here. how can this? here oracle code:

select t_order_demand.customer_name, max(t_order_log.seq) "seq", max(t_order_log.extern_order_status) "extern" t_order_demand,t_order_log t_order_demand.order_id=t_order_log.order_id , t_order_demand.order_id '%88%' grouping t_order_log.seq,t_order_log.extern_order_status,t_order_demand.customer_name;

the result there 2 client names seq column 1 , have 2 extern 0 , 2. want show 1 client name, 1 max seq , 1 max extern. how? please help me.

you need remove seq, extern_order group by changed utilize explicit join

select t_order_demand.customer_name, max(t_order_log.seq) "seq", max(t_order_log.extern_order_status) "extern" t_order_demand bring together t_order_log on t_order_demand.order_id=t_order_log.order_id , t_order_demand.order_id '%88%' grouping t_order_demand.customer_name

if want 1 client out of set

select * ( select t_order_demand.customer_name, max(t_order_log.seq) "seq", max(t_order_log.extern_order_status) "extern" t_order_demand bring together t_order_log on t_order_demand.order_id=t_order_log.order_id , t_order_demand.order_id '%88%' grouping t_order_demand.customer_name ) row_num =1

oracle select max

No comments:

Post a Comment