Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2013

    Unanswered: Please help a noob with some query syntax


    First time poster so sorry if this lacks specificity.

    All I know about our database is that it is Db2, assuming a fairly recent version. This is a very basic syntax question so i'm hoping the lack of that kind of information won't matter.

    As part of a SELECT statement, one of the columns i'm selecting is 'course_outline'. At the moment it is (as it should) returning the actual value within each 'course_outline' cell that I have joined to the 'course' column/table.

    Rather than returning the actual 'course_outline' value, I just want to return something that tells me whether or not there is a value in the cell.

    Logically it would play out as

    course_outline.course_outline <-- (return value 'yes' if cell is not null)
    from course
    INNER JOIN course_outline ON course_outline.course_id = course.course_id

    I have no idea what clause to use to make this happen.

    Thanks and sorry if this is a dumb question.

  2. #2
    Join Date
    Apr 2006
    Provided Answers: 11
    have a look at case :CASE
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified

  3. #3
    Join Date
    Aug 2013
    Thankyou - feeling like less of a noob now. Have massively expanded my ability to write useful queries.

    However, I did find this tutorial on CASE to be a lot more helpful: DB2 SQL examples

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts