Thursday, March 29, 2012

Getting the LATEST DATE in the table

How to modify the below procedure in order to get the latest date ( the biggest value ) in the column "Deadline", type smalldatetime, ( example: 24/02/2007 00:00:00 ) for a given customer "UserName" ?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CREATE PROCEDURE GetLatestDate

(@.UserName VARCHAR(50)

AS

SELECT Deadline

FROM CustomerItems

WHERE UserName = @.UserName

try

select max(Deadline)from CustomerItemswhere UserName = @.UserName

|||Thank you,jdingo .Smilesql

No comments:

Post a Comment