Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Compare Dates and select the max date ?

516596Jun 5 2006 — edited Jun 6 2006
Hello,
I am trying to write a script and will compare the dates in " eff_startdt" and give me the lastest date at the outcome.
I have data that some service locations have more than one contract date and I need to get the latest dated conract dates to work on the data but I tried many things I am always getting errors. When I run the script below I get " missing expression" error. I dont' see anything missing.
also somehow Max() is keep giving me errors when I do something like [ ON service_locs = vmeterid WHERE SERVICE_LOCS = SERVICE_LOCS AND EFF_STARTDT = MAX(EFF_STARTDT) ]

Can someone pls give me advice on this. Thanks

---------------------------------------------------------
SELECT DISTINCT Broker, customer_name, service_locs, fee_kwh, qtr_monthly, eff_startdt, eff_enddt

FROM VMETER

INNER JOIN BROKER_DATA

ON service_locs = vmeterid WHERE SERVICE_LOCS = SERVICE_LOCS AND (SELECT MAX(EFF_STARTDT) FROM VMETER)
-----------------------------------------------------------
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2006
Added on Jun 5 2006
25 comments
2,173 views