SELECT category, MAX(date) AS maxdate ; FROM xx ; GROUP BY category ; INTO CURSOR crsMaxDate NOFILTER SELECT xx.category, ; md.maxdate, ; MAX(IIF(xx.date<md.maxdate, xx.date, {})) AS nextdate ; FROM xx ; JOIN crsMaxDate md ON md.category = xx.category ; GROUP BY xx.category, md.maxdate ; INTO CURSOR crsResult NOFILTER>Using the script below how can I get the MAX() date
>category date secondmostrecent
>A 01/03/2003 01/02/2003
>B 02/03/2003 02/02/2003
>
>>CREATE CURSOR xx (category c(1), date d) >INSERT INTO xx VALUES("A", {^2001/01/01}) >INSERT INTO xx VALUES("A", {^2001/01/02}) >INSERT INTO xx VALUES("A", {^2001/01/03}) >INSERT INTO xx VALUES("B", {^2001/02/01}) >INSERT INTO xx VALUES("B", {^2001/02/02}) >INSERT INTO xx VALUES("B", {^2001/02/03}) > >SELECT category, MAX(date) date FROM xx GROUP BY category >