Jump to content

[SOLVED] Help with Max dates


tpimental

Recommended Posts

I've been struggling with this query for way too long and decided I needed some help.  Seems simple enough, but I get 0 results.

 

I'm trying to get the latest date of a set of IDs (loc_id) in a report set only when that date is older than 1 year.

 

(mysql version 4.0.27)

 

SELECT Max( report_date ) AS LatestDate, loc_id

FROM report_index

WHERE 'LatestDate' < curdate( ) - INTERVAL 365 DAY

GROUP BY loc_id

LIMIT 0 , 500

 

Table looks something like this:

 

loc_id report_date

1 12/13/2001

2 3/4/2003

2 12/13/2001

3 6/4/2003

3 6/4/2003

4 3/6/2003

4 3/6/2003

5 3/14/2003

5 3/14/2003

5 9/8/2003

5 9/8/2003

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/53490-solved-help-with-max-dates/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.