Re: Query to Select Maximum Age
- From: "ManningFan" <manningfan@xxxxxxxxx>
- Date: 7 Sep 2006 12:26:43 -0700
Try using a Group By query instead of using DISTINCT. Group By ptnum,
sex, address, MAX of age. That should give you one record per patient,
unless your data is screwy.
johnds wrote:
Another basic question from newbie. I have a 10 million record database
of patient contact with their physician. The original file contained
all thier clinical information and personal characteristics. Each
patient record was repeated for each visit. I only want a table of
unique records for each patient with their characteristics, simple
enough with select distinct, but I found that I obtained duplicate
records if the patient visited their doctor between birthdays. I have
decided to take the record with their max age as more current. The
following however did not work, any suggestions?
SELECT DISTINCT ptnum, age, sex, address
FROM ptdb
GROUP BY ptnum, age, sex, address
HAVING (max(age));
.
- Follow-Ups:
- Re: Query to Select Maximum Age
- From: johnds
- Re: Query to Select Maximum Age
- References:
- Query to Select Maximum Age
- From: johnds
- Query to Select Maximum Age
- Prev by Date: Re: Most Current Dates to show on Subform
- Next by Date: Re: Query to Select Maximum Age
- Previous by thread: Query to Select Maximum Age
- Next by thread: Re: Query to Select Maximum Age
- Index(es):
Relevant Pages
|
Loading