OK, I have a query that returns three columns
I want to get a fourth column that has the maximum of the second and third column.Code:Part NO MaxInvDate MaxOrdDate 88-829 1998-08-20 00:00:00.000 1998-08-31 00:00:00.000 88-832 1998-07-22 00:00:00.000 1998-08-03 00:00:00.000 88-843 1998-10-16 00:00:00.000 1999-01-13 00:00:00.000 88-844 1999-02-05 00:00:00.000 1999-02-12 00:00:00.000
The resultls should look like this.
I tried this, but does not workHTML Code:Part NO MaxInvDate MaxOrdDate Max Date 88-829 1998-08-20 00:00:00.000 1998-08-31 00:00:00.000 1998-08-31 00:00:00.000 88-832 1998-07-22 00:00:00.000 1998-08-03 00:00:00.000 1998-08-03 00:00:00.000 88-843 1999-10-16 00:00:00.000 1999-01-13 00:00:00.000 1999-10-16 00:00:00.000 88-844 1999-02-05 00:00:00.000 1999-02-12 00:00:00.000 1999-02-12 00:00:00.000
select [Part No], MaxInvDate, MaxOrdDate, iif(MaxInvDate > MaxOrdDate, MaxInvDate, MaxOrdDate) as myMaxDate
from myTable
Please help!
Dave




Reply With Quote