Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178

    Question Unanswered: query won't display nulls

    I have a query that reads head counts of people in different departments from a separate query for each department. The main query just reads the values from the other queries so that they can be displayed on one page.
    If one department has no people in it, then none of the other department's head counts are displayed.
    How do I get a zero to be displayed if there are no people, or how do I display more than one query's results on one page?

    thanks in advance
    ActionAnt

  2. #2
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    Select IIF(ISNULL(name), 0, name)
    from table

    Select ta.columnA, IIF(ISNULL(tb.columnB), 0, tb.columnB)
    from tableA ta
    LEFT OUTER JOIN
    tableB tb ON
    ta.id = tb.id;
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178
    Originally posted by r123456
    Select IIF(ISNULL(name), 0, name)
    from table

    Select ta.columnA, IIF(ISNULL(tb.columnB), 0, tb.columnB)
    from tableA ta
    LEFT OUTER JOIN
    tableB tb ON
    ta.id = tb.id;
    thanks but I managed to do it using:
    Select nz(ta.columnA,0) as Total
    from Table

    nz() is the same as isNull for SQL

Posting Permissions

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