Union overwrite null values

  • Is there a way using union to overwrite null values?

    for example:

    I hava two views with following columns

    att_date, student_id, AM_attendance code , PM_AttendanceCode

    the union is:

    select '9/8/2013', 12345, 'EA', Null

    union

    select '9/8/2013', 12345, Null, 'UA'

    I would like the result be one row instead of the two rows, the null values to be overwritten.

    '9/8/2013', 12345, 'EA', 'UA'

  • How about alternative ways like this?

    SELECT '9/8/2013', 12345,

    (SELECT [AM_attendance code] WHERE student_id = '12345' and [AM_attendance code] is not null),

    (SELECT [PM_AttendanceCode] WHERE student_id = '12345' and [PM_AttendanceCode] is not null)

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • Thanks, will try that

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

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