I need to get the values of a table by validity range. Currently I make a group by the columns of the table and I make a min and max about the year; but this gives me the wrong result for the case of the example. I would need to solve it with sentence sql or with pentaho
Sample data:
year validity Value1 Value2
2004 A B
2006 A C
2007 A B
2008 A B
SQL:
SELECT
min(anio), max(anio), value1, value2
FROM tabla
GROUP BY
value1, value2
Wrong result:
year min year max Value1 Value2
2004 2008 A B
2006 2006 A C
Expected result:
year min year max Value1 Value2
2004 2004 A B
2007 2008 A B
2006 2006 A C
Please help on this issue.