Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004

    Unanswered: Is it possible to prevent an empty set from returning

    with this statement

    SELECT IF( T.CmmtHrs, T.CmmtHrs, 0 )
    as 'committed hours'
    FROM TimeOffHdr T

    and no data in the table I get empty set returned.

    Empty set (0.00 sec)

    The result I would like to get is zero is this possible

    | committed hours |
    | 0 |
    1 row in set (0.00 sec)


  2. #2
    Join Date
    Feb 2003
    Denver, CO
    Are you using PHP? If so, you could use MSQL_NUM_ROWS after your query to check how many rows were returned. If rows are less than one then it is an empty set and you can set committed hours to zero in the code.

Posting Permissions

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