Quantcast
Channel: SQL Query return highest date value in query - Stack Overflow
Browsing index pages (5 articles)

SQL Query return highest date value in query

Im trying to run a query to do the following:return all of the most recent entries in the table between a given date range.Currently I am using this query SELECT id FROM schedule WHERE eventdate...

View Article


Answer by John Ruddell for SQL Query return highest date value in query

NOTE:you said you determine the uniqueness of each day by the three columns eventdate, resource_id, and added_on... but you only want the greatest added_on per day... so do not group by added_on.....

View Article


Answer by Aziz Shaikh for SQL Query return highest date value in query

You need to get the latest record for every unique combination of eventdate, resource_id, added_on, like this:SELECT schedule.* FROM schedule JOIN ( SELECT MAX(id) AS max_id FROM schedule GROUP BY...

View Article

Answer by RSCode for SQL Query return highest date value in query

SELECT s1.* FROM schedule s1 inner join (select max(id) as id1 from schedule WHERE eventdate BETWEEN '2014-09-01' AND '2014-09-07' group by eventdate,resource_id ) as s2 on s2.id1=s1.id It will work...

View Article

Answer by slek for SQL Query return highest date value in query

I think this will be the simplest query you can have. Just comment here if you have further question. SELECT MAX(id) , eventdate, Max(added_on) FROM schedule GROUP BY eventdate.This will...

View Article

Browsing index pages (5 articles)


Latest Images