Waleed Ahmed Waleed Ahmed - 5 months ago 30
SQL Question

c# oracle max sort

please i need help guys i am trying to select some date from a table through c# connection for a oracle server and i want to get only the line with the max last_update_date my code

ocom.commandtext("@Select status,last_update_Date,trans_number
from pas.transaction
where last_update_Date in(select(last_update_Date)
from pas.transaction
where msisdn in("+mdc_line_M+") );


but it return nothing can anyone help as i am trying from 2 days ago

Answer

You should use max(last_update_Date)

ocom.commandtext("@Select status,last_update_Date,trans_number
from pas.transaction
where last_update_Date in (
        select max(last_update_Date) 
       from pas.transaction  
       where msisdn in("+mdc_line_M+") 
);"