case with if ?

  • Hi

    I need to compare two dates and use one depending on the case

    needs to be something like

    if table1.expdate is not null then use table1.expdate

    else if table2.expdate is null use '2099-12-31' else use table2.expdate end as enddate

    Thanks

    Joe

  • SELECT COALESCE(table1.expdate, table2.expdate, '2099-12-31') as enddate

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • Thanks Sean

    Works great.. should have known that one 🙁

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

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