Skip to main content

Posts

Showing posts with the label Compare two dates in a table and return the greater using SQL Server

Compare two dates in a table and return the greater using SQL Server

How To Compare two dates in a table and return the greater usingSQL Server? We can get and return using  CASE  statement in  SQL Server i.e. CASE     WHEN   STARTDATE  >=  ENDDATE         THEN   STARTDATE     ELSE   ENDDATE END Example :-    SQL Server case date comparison SELECT              EXCEPTIONID ,              ( CASE                 WHEN   INSERTEDDATE  >=  UPDATEDDATE                             THEN   INSERTEDDATE              ...