Senin, 14 Agustus 2017

Re: RE: [MS_AccessPros] Count query not returning correct numbers

 

This returned all the dependents per household. Which is good. What I was after was adults plus dependents. Every rexeam we count how many adults and dependents to see if that has change over the course of the year.


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‎ ‎06‎:‎03‎:‎17‎ ‎PM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


 

Do you get any records returned with this SQL:

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
WHERE tblHousehold.MemberType IN ("2")
GROUP BY tblUnit.UnitCode, tblHousehold.MemberType;

If not, something is wrong with your logic. I can't imagine performing re-exams based on the dependents records from tlbHouseHold.

Duane

From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of Art Lorenzini dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Monday, August 14, 2017 5:05 PM
To: Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]
Subject: Re: RE: [MS_AccessPros] Count query not returning correct numbers
 
Duane,

I executed the SQL you sent me and it returned adults only just like mine did...


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‎ ‎05‎:‎03‎:‎45‎ ‎PM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


 

Art,
Are you still having an issue? Did you try the SQL that I suggested?

Regards,
Duane Hookom

From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of Art Lorenzini dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Monday, August 14, 2017 3:29 PM
To: 'Graham Mandeno' graham@mandeno.com [MS_Access_Professionals]
Subject: Re: RE: [MS_AccessPros] Count query not returning correct numbers
 
Graham, I think I over thought this.....

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;



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‎ ‎02‎:‎38‎:‎56‎ ‎PM, 'Graham Mandeno' graham@mandeno.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


 

Hi Art

Can you please describe the relationships between your three tables?  Also, what is the purpose of tblReExam?

Best wishes,
Graham

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Tuesday, 15 August 2017 06:42
To: Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Subject: Re: [MS_AccessPros] Count query not returning correct numbers

 

 

This query is still only returning the adult count for the unit. In the first record returned there is only 1 adult and 3 dependents but on the 1 adult is being returned.

 


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‎ ‎12‎:‎52‎:‎47‎ ‎PM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

 

 

 

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

WHERE tblHousehold.MemberType IN ("1","2")
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

 

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 (13)

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