MAX DATE
Hi, I am running the following query to give me the employeeid associated
with the MAX LASTOFDATEASSIGNED. Problem is that it returns two values instead
of just one. What am I doing wrong? Please help
SELECT DISTINCT dbo.T_PENDING_ASGM.ASSIGNEE_EMP_ID, dbo.PENDING_ASSIGNEE.LASTOFDATEASSIGNED
FROM dbo.PENDING_ASSIGNEE LEFT OUTER JOIN
dbo.T_PENDING_ASGM ON dbo.PENDING_ASSIGNEE.PENDING_ID
= dbo.T_PENDING_ASGM.PENDING_ID
WHERE (dbo.PENDING_ASSIGNEE.PENDING_ID = 24679)
# 1 Re: MAX DATE
I don't see where the max lastofdateassigned comes in. Maybe we need some
explanation of what each of the tables are and what they hold.
In general, distinct won't limit the result set to one record. (I assume
you mean two records are returned instead of two values?) You should use
a select top 1 ... if you only want one record.
"SHERYL KEMP" <DIANEDINERO@AOL.COM> wrote:
>
>Hi, I am running the following query to give me the employeeid associated
>with the MAX LASTOFDATEASSIGNED. Problem is that it returns two values
instead
>of just one. What am I doing wrong? Please help
>
>SELECT DISTINCT dbo.T_PENDING_ASGM.ASSIGNEE_EMP_ID, dbo.PENDING_ASSIGNEE.LASTOFDATEASSIGNED
>FROM dbo.PENDING_ASSIGNEE LEFT OUTER JOIN
> dbo.T_PENDING_ASGM ON dbo.PENDING_ASSIGNEE.PENDING_ID
>= dbo.T_PENDING_ASGM.PENDING_ID
>WHERE (dbo.PENDING_ASSIGNEE.PENDING_ID = 24679)
Kevin at 2007-11-11 23:55:39 >
