Below is what i have from centers A and B (nothing from C yet) from my
union
query. the study IDs have 5 characters ranging from A1001 to A1999 for
males, A2001 to A2999 for females. Same for B and C. the first character
refers to the center and the second for gender.
can I use what you pasted below or use an IIF statement?
SELECT [SCREENING AND ENROLLMENT 2].[Study ID], [SCREENING AND ENROLLMENT
2].Sex, [SCREENING AND ENROLLMENT 2].Age, [SCREENING AND ENROLLMENT
2].Race,
[SCREENING AND ENROLLMENT 2].Ethnicity, [SCREENING AND ENROLLMENT
2].Creatinine, [SCREENING AND ENROLLMENT 2].Tenofovir, [SCREENING AND
ENROLLMENT 2].[Scheduled Screening], [SCREENING AND ENROLLMENT 2].[Had
Screening Visit], [SCREENING AND ENROLLMENT 2].Enrolled, [SCREENING AND
ENROLLMENT 2].[Had study vist], [SCREENING AND ENROLLMENT 2].Screened,
IIf([Age]<40,"40<",IIf([Age]>=40 And
[Age]<60,"40-60",IIf([Age]>60,"60>","No
data"))) AS [Age Group], IIf([Creatinine]<1,"1.0<",IIf([Creatinine]>=1 And
[Creatinine]<1.4,"1.0-1.4",IIf([Creatinine]>1.4,"1.4>","No data"))) AS
[Creatinine Group]
FROM [SCREENING AND ENROLLMENT 2];
UNION ALL SELECT [SCREENING AND ENROLLMENT 21].[Study ID], [SCREENING AND
ENROLLMENT 21].Sex, [SCREENING AND ENROLLMENT 21].Age, [SCREENING AND
ENROLLMENT 21].Race, [SCREENING AND ENROLLMENT 21].Ethnicity, [SCREENING
AND
ENROLLMENT 21].Creatinine, [SCREENING AND ENROLLMENT 21].Tenofovir,
[SCREENING AND ENROLLMENT 21].[Scheduled Screening], [SCREENING AND
ENROLLMENT 21].[Had Screening Visit], [SCREENING AND ENROLLMENT
21].Enrolled,
[SCREENING AND ENROLLMENT 21].[Had study vist], [SCREENING AND ENROLLMENT
21].Screened, IIf([Age]<40,"40<",IIf([Age]>=40 And
[Age]<60,"40-60",IIf([Age]>60,"60>","No data"))) AS [Age Group],
IIf([Creatinine]<1,"1.0<",IIf([Creatinine]>=1 And
[Creatinine]<1.4,"1.0-1.4",IIf([Creatinine]>1.4,"1.4>","No data"))) AS
[Creatinine Group]
FROM [SCREENING AND ENROLLMENT 21];
vanderghast said:
Depends of your UNION query:
SELECT field1, field2, ...., "A" AS center FROM A1001
UNION ALL
SELECT field1, field2, ..., "B" FROM B1001
UNION ALL
SELECT field1, field2, ... "C" FROM C1001
then, you can GROUP over the Center field to have your stats 'by
center'.
Vanderghast, Access MVP
AGOKP4 said:
Hi,
I created a similar database for use in 3 different centers, the only
difference between the data from these centers is the first letter of
the
subject ID (A1001, B1001, and C1001), each corresponding to a different
center.
I have combined the data coming in from these 3 sites using a union
query.
Is it possible to summarize by center in a query? The SQL statement
below
refers to age group summary, is it possible to have this done in a
query
(or
any suitable method) by center using the study ID?
Thanks!!
SELECT [Screened Qry].[Age Group], Count([Screened Qry].[Age Group]) AS
[CountOfAge Group]
FROM [Screened Qry]
GROUP BY [Screened Qry].[Age Group];