Results 1 to 4 of 4
  1. #1
    veritoanimus is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    2

    Subtotal Count

    So, I do a lot of Database programming, but normally I'm working with a web front-end. Because of this I've taken the approach of having the ASP.NET code to a lot of the work and never really got into more complex queries. At this point I have a project that's a little different though and I don't have the luxury of making anything external, so everything is in Access 2010.



    I have a table that contains the following:

    ID, Category, Name, DateAdded, ...(Other Data)


    What I need is a query that will give me a listing that will output as:

    Unique Category, Count of Items in Category, Earliest Date for Items in Category.

    I was thinking I'd probably have to do this as a stored query that creates a temporary table, but I'm thinking that there has to be an easier way, and that it's probably been done enough times for different things that someone probably knows the query pretty well. This is being used as a work queue if that helps at all.

    Anyone here ever have to do something like this before and know a nice way to do it?

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Welcome to the forum!

    All you would need to do is to create (and save) the query. When you need to see the data just run the query. Access will display the results in a basic datasheet view. There would be no need to make another table. You could also bind the query to a form. When you open the form, Access will automatically run the query and display the results in the form (you use the form to format the data the way you want).

    It sounds like you will need an aggregate query

    SELECT category, Count(category), Min(dateadded)
    FROM yourtablename
    GROUP BY category

  3. #3
    veritoanimus is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    2
    Quote Originally Posted by jzwp11 View Post
    Welcome to the forum!

    All you would need to do is to create (and save) the query. When you need to see the data just run the query. Access will display the results in a basic datasheet view. There would be no need to make another table. You could also bind the query to a form. When you open the form, Access will automatically run the query and display the results in the form (you use the form to format the data the way you want).

    It sounds like you will need an aggregate query

    SELECT category, Count(category), Min(dateadded)
    FROM yourtablename
    GROUP BY category
    Thanks a ton, I'm glad I posted... that's a lot easier than I expected... I'll have to test it out.

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You're welcome. Let us know if you encounter any problems in your testing.

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

Similar Threads

  1. Help with subtotal first record in report
    By leslina76 in forum Access
    Replies: 1
    Last Post: 08-25-2011, 01:54 PM
  2. Continuous Form Subtotal
    By luckysarea in forum Forms
    Replies: 5
    Last Post: 05-20-2011, 01:48 PM
  3. Subtotal
    By abc in forum Access
    Replies: 3
    Last Post: 01-31-2011, 04:47 PM
  4. Replies: 0
    Last Post: 07-15-2010, 12:32 PM
  5. Replies: 25
    Last Post: 03-31-2010, 11:10 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