I created it as a value List on the form so Access interprets it as a string: 1;Adult;2;Dependent
With Warm Regards,
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
"Valar Dohaeris"
On Monday, August 14, 2017 01:07:42 PM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Art,
Also, is MemberType an actual numeric field or text. Your SQL suggests text.
Duane
From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Monday, August 14, 2017 12:52 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Count query not returning correct numbers
Sent: Monday, August 14, 2017 12:52 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Count query not returning correct numbers
Art,
How do you expect to see the counts: different columns in the same row or a row for Adult and a row for Dependent?
I would expect to see MemberType in the SELECT. I would also change the HAVING clause to a WHERE clause and use IN ().
SELECT tblUnit.UnitCode, MemberType, Count(tblHousehold.HouseholdID) AS CountOfHouseholdID
FROM (tblUnit INNER JOIN tblReExam ON tblUnit.UnitID = tblReExam.UnitID) INNER JOIN tblHousehold ON tblReExam.ReExamID = tblHousehold.ReExamID
FROM (tblUnit INNER JOIN tblReExam ON tblUnit.UnitID = tblReExam.UnitID) INNER JOIN tblHousehold ON tblReExam.ReExamID = tblHousehold.ReExamID
WHERE tblHousehold.MemberType IN ("1","2")
GROUP BY tblUnit.UnitCode, tblHousehold.MemberType;
GROUP BY tblUnit.UnitCode, tblHousehold.MemberType;
If you want a column for Adult and a column for Dependent you could create a crosstab query.
Duane Hookom
From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Monday, August 14, 2017 12:17 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Count query not returning correct numbers
Sent: Monday, August 14, 2017 12:17 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Count query not returning correct numbers
I have the following query:
SELECT tblUnit.UnitCode, Count(tblHousehold.HouseholdID) AS CountOfHouseholdID
FROM (tblUnit INNER JOIN tblReExam ON tblUnit.UnitID = tblReExam.UnitID) INNER JOIN tblHousehold ON tblReExam.ReExamID = tblHousehold.ReExamID
GROUP BY tblUnit.UnitCode, tblHousehold.MemberType
HAVING (((tblHousehold.MemberType)="1" Or (tblHousehold.MemberType)="2"));
What I am trying to get is a total count of household members per Unit Code. Member Type = 1=Adult and 2 = Dependent. But this query is only return the adult count per unit. What am I missing?
Thank you,
Art Lorenzini
Sioux Falls, SD
__._,_.___
Posted by: Art Lorenzini <dbalorenzini@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.
.
__,_._,___
Tidak ada komentar:
Posting Komentar