|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Comparing the dates and getting the MAX date??
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) ----------------------------------------------------------- |
|
#2
|
||||
|
||||
|
Does this work?
SELECT Broker, customer_name, service_locs, fee_kwh, qtr_monthly, eff_startdt, eff_enddt FROM vmeter INNER JOIN broker_data ON service_locs = vmeterid ORDER BY vmeter.eff_startdt LIMIT 1
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter! DevArticles Forum Moderator "The net is a waste of time, and that's exactly what's right about it." -- William Gibson |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Comparing the dates and getting the MAX date?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|