[AccessD] Count of Unique Records

Susan Harkins harkins at iglou.com
Wed May 28 10:25:30 CDT 2003


SELECT groupfield1, Count(groupfield2) 
FROM (SELECT groupfield1, groupfield2
FROM datasource
GROUP BY groupfield1, groupfield2)
GROUP BY groupfield2

Maybe that'll get you closer to what you need?

Susan H. 


  Susan -

  This is pretty much what my 1st query does.

  I then have a 2nd query that counts these records for a total count of unique records.

  What I want to do is only use 1 query that will return the number '3'.



  Mark



  -----Original Message-----
  From: Susan Harkins [mailto:harkins at iglou.com] 
  Sent: Wednesday, May 28, 2003 10:59 AM
  To: accessd at databaseadvisors.com
  Subject: Re: [AccessD] Count of Unique Records



  Sure. 



  SELECT Count(field)

  FROM datasource

  GROUP BY field

    ----- Original Message ----- 

    From: Mark Boyd 

    To: AccessD at databaseadvisors.com 

    Sent: Wednesday, May 28, 2003 10:35 AM

    Subject: [AccessD] Count of Unique Records



    I have a table with the following records:

    John

    John

    Bill

    Bob



    I need to find out how many unique records there are.

    My current approach is 1 query grouping the above table.

    Then, I get a count of grouped records with a 2nd query.



    Is there a way to avoid using 2 queries for this?

    The above is obviously an example.  The table actually holds thousands and thousands of records.



    Thanks,

    Mark Boyd

    Sr. Systems Analyst

    McBee Associates, Inc.




----------------------------------------------------------------------------

    _______________________________________________
    AccessD mailing list
    AccessD at databaseadvisors.com
    http://databaseadvisors.com/mailman/listinfo/accessd
    Website: http://www.databaseadvisors.com



------------------------------------------------------------------------------


  _______________________________________________
  AccessD mailing list
  AccessD at databaseadvisors.com
  http://databaseadvisors.com/mailman/listinfo/accessd
  Website: http://www.databaseadvisors.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030528/a785dbbf/attachment-0001.html>


More information about the AccessD mailing list