Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    bangemd is offline Novice
    Windows XP Access 2002 (version 10.0)
    Join Date
    May 2009
    Posts
    18


    Quote Originally Posted by thhui View Post
    I have tried the code in my database and table and it works!

    Pls check your code for the table name as mine is Table1.
    Others are the same as yours.
    Hey thank you it work flawlessly. I was trying to learn so I didn't used the fruit example. I create a new database and the field is just confusing trying to match the fruit example

    thanks a lot guys

  2. #17
    bangemd is offline Novice
    Windows XP Access 2002 (version 10.0)
    Join Date
    May 2009
    Posts
    18
    one last question relate to the problem how would I count the blank cell for example if one cell people haven't check out if it is a good or bad apple yet how would i incorporate in into the sql

  3. #18
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    The new revised code for your new question of including null status is as follows:-
    Code:
    SELECT fruit, 
    Count([fruit])/(Select Count([fruit]) from Table1) AS [% of Fruit], 
    Sum(iif([Status]="Good",1,0))/Count([fruit]) AS [% of Good], 
    Sum(iif([Status]="Bad",1,0))/Count([fruit]) AS [% of Bad], 
    Sum(iif(isnull([Status]),1,0))/Count([fruit]) AS [% of NULL] 
    FROM Table1 
    GROUP BY fruit;
    Last edited by thhui; 05-21-2009 at 10:52 PM.

  4. #19
    bangemd is offline Novice
    Windows XP Access 2002 (version 10.0)
    Join Date
    May 2009
    Posts
    18
    Thank you everyone I learned so much form you guy

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. need help with queries
    By gromit95 in forum Queries
    Replies: 1
    Last Post: 02-06-2009, 06:50 AM
  2. percentage in a query
    By Peljo in forum Access
    Replies: 2
    Last Post: 02-27-2008, 10:51 AM
  3. Crosstab Queries
    By albst130 in forum Queries
    Replies: 0
    Last Post: 03-07-2007, 09:32 AM
  4. Queries the max from two rows
    By mohsin74 in forum Queries
    Replies: 0
    Last Post: 12-15-2006, 12:52 AM
  5. VBA and stacked queries
    By Pudy in forum Queries
    Replies: 0
    Last Post: 11-28-2006, 03:58 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