Counting instances in query

N

Nyrubi

How do I setup query to count instances on table. I have many rows of
claims. There are many fields but I need to narrow it down to ID, start
date. I need to find 2 instances for each member. thank you.
 
M

MGFoster

Nyrubi said:
How do I setup query to count instances on table. I have many rows of
claims. There are many fields but I need to narrow it down to ID, start
date. I need to find 2 instances for each member. thank you.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Your criteria are unclear so this is a guess....:

SELECT ID, start_date, COUNT(*) As MemberCount
FROM table_name
GROUP BY ID, start_date
HAVING COUNT(*) = 2

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSXjos4echKqOuFEgEQLP+wCfWEkIo4+k38QI226cW5KeSTHO+U0An1Tm
OWdr45lNdRjeoloCjV2xPqah
=/9dp
-----END PGP SIGNATURE-----
 
J

John W. Vinson

How do I setup query to count instances on table. I have many rows of
claims. There are many fields but I need to narrow it down to ID, start
date. I need to find 2 instances for each member. thank you.

Please explain with an example of your existing data and desired output. Your
question is ambiguous - my guess is that you have multiple dates per ID and
want to retrieve only two of each ID, but you give no indication of WHICH two.
Or you might be meaning something else entirely!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top