This query ...
SELECT tbl_Person.Lname, tbl_Case.CaseNo, tbl_Case.Date, tbl_Charges.Section
FROM (tbl_Case INNER JOIN tbl_Person ON tbl_Case.CaseID = tbl_Person.CaseID) INNER JOIN tbl_Charges ON (tbl_Person.PersonID = tbl_Charges.PersonID) AND (tbl_Person.PersonID = tbl_Charges.PersonID)
ORDER BY tbl_Person.Lname;
Produces this output ...
Last CaseNo Date Section
Brown 3 12/3/2005 653.22
Edmonds 2 12/2/2005 653.22
Green 2 12/2/2005 647(b)
Johnson 1 12/1/2005 647(b)
Jones 1 12/1/2005 653.22
Jones 4 4/4/2006 653.22
Jones 6 5/5/2005 647(f)
Jones 1 12/1/2005 647(b)
Jones 6 5/5/2005 653.22
How can I construct a query that will return records for a person - only - when they have two or more unique CaseNo records.
The new query should only return these records ...
Last CaseNo Date Section
Jones 1 12/1/2005 653.22
Jones 4 4/4/2006 653.22
Jones 6 5/5/2005 647(f)
Jones 1 12/1/2005 647(b)
Jones 6 5/5/2005 653.22
if possible with a total unique CaseNo field holding the number of unique Case Numbers for each person.
These records are selected because Jones has three unique values (1, 4, 6), among the five records in the result set of the CaseNo field.
Any help is appreciated.
Thanks
John
SELECT tbl_Person.Lname, tbl_Case.CaseNo, tbl_Case.Date, tbl_Charges.Section
FROM (tbl_Case INNER JOIN tbl_Person ON tbl_Case.CaseID = tbl_Person.CaseID) INNER JOIN tbl_Charges ON (tbl_Person.PersonID = tbl_Charges.PersonID) AND (tbl_Person.PersonID = tbl_Charges.PersonID)
ORDER BY tbl_Person.Lname;
Produces this output ...
Last CaseNo Date Section
Brown 3 12/3/2005 653.22
Edmonds 2 12/2/2005 653.22
Green 2 12/2/2005 647(b)
Johnson 1 12/1/2005 647(b)
Jones 1 12/1/2005 653.22
Jones 4 4/4/2006 653.22
Jones 6 5/5/2005 647(f)
Jones 1 12/1/2005 647(b)
Jones 6 5/5/2005 653.22
How can I construct a query that will return records for a person - only - when they have two or more unique CaseNo records.
The new query should only return these records ...
Last CaseNo Date Section
Jones 1 12/1/2005 653.22
Jones 4 4/4/2006 653.22
Jones 6 5/5/2005 647(f)
Jones 1 12/1/2005 647(b)
Jones 6 5/5/2005 653.22
if possible with a total unique CaseNo field holding the number of unique Case Numbers for each person.
These records are selected because Jones has three unique values (1, 4, 6), among the five records in the result set of the CaseNo field.
Any help is appreciated.
Thanks
John