Results 1 to 2 of 2

Thread: SQL Count

  1. #1
    Join Date
    Jul 2004

    Angry Unanswered: SQL Count


    I have a table of orders which includes the fields "Company" (text) "Approved_Date" (date) and "Urgent" (True/False).

    I have a query that groups by Company. I want to count the instances of Approved items, and Approved & Urgent items.

    I can do the Approved : Count(Approved_Date), no problem, it just counts those entries which aren't NULL.

    But...... I can't seem to count where BOTH fields are NOT NULL.

    I tried Count(Approved_Date AND Urgent), but [according to the access help] it counts instances where either aren't NULL, so I also get those Urgent records that haven't been approved!! Grrrrr, that's an OR operand, not an AND.........grrrrrr hmph, blaaaahhhhh!!!!!

    Anyone know how to count where both are NOT NULL and stop this smoke coming out of my ears?????

    Many thanks,


  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    =sum(iif(IsNull(Approved_date), iif(IsNull(Urgent), 1, 0), 0))
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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