Finding Names that appear more than once in a table

Shannon3778

Registered User.
Local time
Today, 09:02
Joined
Dec 13, 2012
Messages
29
I have a table with associate names and rankings for each month. I need some way to find out which associates appear in 2 consecutive months with a certain rating. I have a query that will allow you to key in which month you want to look at, but I can't figure out how to write the query to return results only for those associates that appear twice in the months chosen. For example:
John Doe was rated 1.5 in May and 3 in June.
Jane Doe was rated a 1.5 in May and 1.5 in June.

I want a query that will allow me to put in May and June as the criteria as well as < 2 for the rating and only return those that show in both months... in this case, only Jane Doe. Help?!?!?!:banghead:
 
Provide some sample data your table. Then, based on that sample data, post what you want returned from your query. Be sure to include table and field names. Use this format for posting your data:


Table1NameHere
Field1NameHere, Field2NameHere, Field3NameHere
David, 12, 4/3/2008
Steve, 8, 5/16/2010
Amy, 2, 6/6/2007
 
Here is a sample... I need a query that will return anyone with a rating of 2 or below in May AND June instead of May or June...
 

Attachments

You need to run a totals query group by name and count name and where on period , criteria on the count of =2
This query is joined to the table in query2 where you extract the data you require.

I would run this from a form containing the textboxes for the months to avoid having to enter them twice and a command button to run query2, you could if you want make query1 a sub query rather than use stacked queries.

Brian
 
You have posted since I started to type, I cannot read an accdb but the only difference in may and June as opposed to may or June is the way you write the criteria. In the design grid may and June will be on separate rows and each row will have the criteria for the rating of=<2 .

Brian
 
Is this what you are looking for ?

SELECT Table1.Associate, Count(Table1.Month) AS CountOfMonth
FROM Table1
WHERE (((Table1.Rating)<2))
GROUP BY Table1.Associate
HAVING (((Count(Table1.Month))>=2));
 

Users who are viewing this thread

Back
Top Bottom