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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.