populate a column based on a heiarchy of returned values

  • I have 5 subqueries that return a memo field in a select query.

    it looks like this select ptpg.notetext,

    mepg.notetext,

    etc.

    I would like to create a 6th column either in addition to or more preferably in lieu of the 5 subqueries where there's a heirarchy like this

    if subquery 1 did not return a null then col 6 = ptpg.notetext

    else if subquery 2 did not return a null then col 6 = mepg.notetext

    etc.

    I've tried an if statement in the select statement, but get a syntax error {tried with and without parenthesis around the clause,

    I suspect strongly that a case statement will work unless I can nest case statements within one another.

  • COALESCE

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

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