View definition

Hi All

I need to incorporate the condition below into a view definition. Any help appreciated.
TIA
Alan
.
.
.
WHERE
If Date1 is not null then Date1 must be before Date2

No exactly sure what you mean.

Try a CASE WHEN statement

CASE WHEN Date1 IS NOT NULL THEN 
    CASE WHEN Date1 < Date2 THEN Date1 ELSE Date2-1 END
END

This is of the top of my head so probable needs work.

A where condition in your select statement of the create view?

WHERE
   Date1 IS NULL OR Date1 < Date2

Hi djj55

The CASE solution worked with a couple of tweaks.
Thanks

Alan