From: Aldred on 25 Mar 2010 03:29 Hi all, I have a select statement like this: Select Max(A_Date), Max(B_Date) From blah blah blah... How could I have my select statement to return the bigger (later) value of these 2 selected fields? Thanks.
From: Allen Browne on 25 Mar 2010 05:21 Select Max(A_Date) AS MaxA, Max(B_Date) AS MaxB IIf(MaxB > MaxA, MaxB, MaxA) AS MostRecent FROM Table1 GROUP BY ... If you have multiple to choose from, you can use the MaxOfList() function here: http://allenbrowne.com/func-09.html (Of course, that should not happen, since repeating fields like that indicate you don't have a normalized schema.) -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Aldred(a)office" <aldred> wrote in message news:8F09927A-4E18-4A4D-8F1C-7D80CFA85F6B(a)microsoft.com... > Hi all, > I have a select statement like this: > > Select Max(A_Date), Max(B_Date) > From blah blah blah... > > How could I have my select statement to return the bigger (later) value of > these 2 selected fields? > > Thanks.
|
Pages: 1 Prev: SQL searches Next: Changing recordsource.. query in comboboxes |