Maximum of date values

  • SELECT MAX(v)
    FROM (VALUES ('2018-01-01') (GETDATE())) AS value(v);

    I get an 'Incorrect Syntax' message.  What needs to be changed?

    EDIT: Found the error as a comma was missing between the two values.

  • saintor1 - Tuesday, January 8, 2019 7:12 AM

    SELECT MAX(v)
    FROM (VALUES ('2018-01-01') (GETDATE())) AS value(v);

    I get an 'Incorrect Syntax' message.  What needs to be changed?

    EDIT: Found the error as a comma was missing between the two values.

    Try the below, you were missing a comma

    SELECT MAX(v)
    FROM (VALUES ('2018-01-01'),(GETDATE())) AS value(v);

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply