I have table name employee_1 suppose in oracle. If the mobile_no and sim_no is same i want select maximum start_date. I have tried , but no success. Please help The employee_1 t
NOTE: Your definition, example data and expected result are not consistent. See that you include in the result the line:
1111111111 1111111112 11/10/2017 21:02:44 13/10/2017 21:02:44
where the Mobile and SIM numbers are different.
Still, try this:
EDIT: TOP 1
was replaced with LIMIT 1
(Oracle).
SELECT LIMIT 1 Mobine_No , Sim_No , Start_Date , End_Date
FROM YourTable
WHERE Mobine_No = Sim_No
ORDER BY Start_Date DESC ;
Alternative:
SELECT Mobine_No , Sim_No , MAX(Start_Date) , End_Date
FROM YourTable