Home Way to find the maximum dates with no futuristic dates
Reply: 0

Way to find the maximum dates with no futuristic dates

user738
1#
user738 Published in June 19, 2018, 6:16 pm

I'm trying to list the latest Quantity (MAX EffectiveDate time avoiding Futuristic EffectiveDate) for each Code in a table

Code     Quantity EffectiveDate
1        2        1-Mar-2018
1        3        1-Apr-2018
1        3        1-May-2018
1        3        1-June-2018
2        5        1-Mar-2018
2        6        1-Apr-2018
3        7        1-Feb-2018
3        8        1-Mar-2018
3        5        1-Apr-2018

The Desired output should be:

Code     Quantity EffectiveDate
1        3        1-May-2018
2        6        1-Apr-2018
3        5        1-Apr-2018

I tried the solution from GROUP BY with MAX(DATE) But it is showing futuristic data.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.259433 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO