RE: Relationships, Default Numbers, Queries
- From: knowshowrosegrows <knowshowrosegrows@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Aug 2007 12:58:04 -0700
Thanks for your swift reply.
When I made the left join as you suggested, I got records for the 37 of the
total 67 programs. these are the programs with data for the date requested.
The SQL for that query follows:
SELECT tblProgram.Prm_Code, tblCensusEvent.CensusDate,
tblCensusEvent.Census, tblCensusEvent.Admiss, tblCensusEvent.Discharges,
tblContactInfo.Contact_ID, tblLOC.LOC_ID, tblAgency.Agency_ID
FROM tblAgency INNER JOIN (tblContactInfo INNER JOIN (tblLOC INNER JOIN
(tblCensusEvent INNER JOIN tblProgram ON tblCensusEvent.Prm_Code =
tblProgram.Prm_Code) ON tblLOC.LOC_ID = tblProgram.LOC_ID) ON
tblContactInfo.Contact_ID = tblProgram.Contact_ID) ON tblAgency.Agency_ID =
tblProgram.Agency_ID
WHERE (((tblCensusEvent.CensusDate)=#8/22/2007#));
--
Thanks
"KARL DEWEY" wrote:
Use a left join from program to the other tables..
If you post your query SQL folks can suggest how to make it work.
--
KARL DEWEY
Build a little - Test a little
"knowshowrosegrows" wrote:
I am having trouble figuring out how to track dates in my database.
Tables =
tblProgram
Program_ID PK
LOC_ID FK
Contact_ID FK
Agency_ID FK
tblCensusEvent
Census_ID PK
Program_ID FK
CensusDate
Census - Default = 0
Admissions - Default = 0
Discharges - Default = 0
tblAgency
Agency_ID PK
tblContact
Contact_ID PK
tblLOC
LOC_ID PK
I need a query that tells me about the census events for a given census date
for all the programs regardless of whether information was entered or not for
each program. So, if only 3 of 100 programs reported a census on 1/1/01, I
have 97 rows with zeros in the Census, Admission and Discharge fields for
that date.
When I write the queries I have tried, I end up with a report of the 3
records that had data, rather than the 100 records with all the zeros.
--
Thanks
- Follow-Ups:
- RE: Relationships, Default Numbers, Queries
- From: KARL DEWEY
- RE: Relationships, Default Numbers, Queries
- Prev by Date: Re: Error Message "Index or Primary Key cannot contain a null value"
- Next by Date: Re: Check Boxes
- Previous by thread: Database Blinking
- Next by thread: RE: Relationships, Default Numbers, Queries
- Index(es):
Relevant Pages
|