Results 1 to 2 of 2
  1. #1
    akika is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    27

    access 16, amend queries to make count per columns


    Hi,

    How can i amend below query to add more conditions to it as in counts in the output:
    Table: tbl_order
    columns (ID, Order_status, Order, Sent, Order_Response, Delivery_Status).


    SELECT
    Count(tbl_order.ID) AS Balance,
    Sum(IIf([tbl_order.Order_Status]="Active",1,0)) AS Order_status_Active,
    Sum(IIf(tbl_order.[Order_sent]="Yes",1,0)) AS Order_Sent,
    Sum(IIf([tbl_order.Order_Response]="Yes",1,0)) AS Order_Response
    FROM tbl_order;

    ---------
    Count for the Outputs of query:

    Num of Records
    Order_Status
    (Get total Count with status = Active)
    Order_Sent
    (get total Count with order_status = Active AND order_sent = Yes)
    Order_Response
    (get total Count with Order_status = Active, and Order_sent=Yes, and Order_Response = Yes)

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This type of thing:

    Sum(IIf(tbl_order.[Order_sent]="Yes" AND [Order_Status]="Active",1,0)) AS Order_Sent
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Use Command button to clear one table and amend another
    By HotelierDream in forum Programming
    Replies: 7
    Last Post: 12-24-2020, 08:27 AM
  2. Replies: 1
    Last Post: 09-15-2020, 10:17 AM
  3. Can I Make Access DCount Emulate Count?
    By tgall in forum Forms
    Replies: 8
    Last Post: 02-10-2016, 08:25 AM
  4. Replies: 6
    Last Post: 03-11-2015, 08:39 AM
  5. Replies: 12
    Last Post: 04-15-2014, 12:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums