Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Problem with MAX() function

Author  Topic 

arockia
Starting Member

1 Post

Posted - 2011-05-19 : 03:13:24
Hi,
I have a query lik this.
SELECT a.intel_site_nbr,
a.stkrm_id,
a.itm_id,
a.trx_dsc,
MAX(a.trx_dt) as 'mx_trx_dt' INTO #zbin_maxdt_ae_agunasex
from vb_mdw_itm_stkrm_acum a,
#zbin_curr_ae_agunasex

The trx.dt is a datetime column.when the column inserted in temp table the value is coming as 2003-10-20 00:00:00.000 instead of 2003-10-20 15:36:00.000.
Can anyone please help me out in this?
why the time is missing?
is this the way the max() function work with datetime field?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-05-19 : 03:25:56
The query above cannot work since there is missing a GROUP BY statement.
And the ONLY reason for the query above to not transfer the time part, is that the time part is not present in the trx_dt column!



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -