PDA

Click to See Complete Forum and Search --> : Greatest among the given dates


Parasu Raman
Jul 4th, 2001, 05:39 AM
Dear all,
I want to get the greatest date (in datetime format) from a table.
when I try,

<%
....
rs.open "select max(cr_dt) as ma from prospect",cn
response.write(rs(0))
...
%>

The output is 7/4/2001 10:21:27 AM.
But I have another value 7/4/2001 1:53:10 PM, which is greater than the output value.

I guess the max() function isnt working properly with the datetime field.

How should I get the greater datetime from my table

Cheers and thanx in advance
Parasuraman

MarcelB
Jul 4th, 2001, 09:23 AM
Okay, I haven't tried thius myself, but why not try something like:

rs.open "select cr_dt as ma from prospect where not exists (select cr_dt as ma2 from prospect where ma2 > ma)",cn
response.write(rs(0))


I think it could work.... right?
Marcel