Hi,
I'm having a problem with getting the right number of records to return when I do a left join.
My original table (133334_0215_WITHOUT_INV) HAS 59,919 records. My second table (133334_0215_JUST_INV) has 40,728 records.
These 40,728 are based on an index of my original query. I'm pulling a field called Invoice # that I cannot pull in the
original query. So my second query is pulling just the fields I need to join on, in addition the field that I need -
(inv_num) The fields I'm matching on are: ccmc #, and date.
These two fields are what is common between the two tables. Once I match on these two fields, I want all output fields
displayed (all fields from table: 133334_0215_WITHOUT_INV, plus the field of INV_NUM from the table: 133334_0215_JUST_INV)
I know that my total number of records should always = 59,919 - it's just that of these 59,919 some will have an INV_NUM, and
some will not. According to my second table, there should be 40,728 records with an invoice # out of the total # of 59,919.
I'm not sure what I'm doing wrong, but using access query wizard, I'm left joining on ccmc # and the date fields between the
two tables, and I do get records back - 45,716 with an INV_NUM, and 17,931 without an Inv_num - this = 63,647 which is more
that my original file of 59,919.
I'm not sure what is happening, but my final output should be only 59,919 records, of which 40,728 should have an INV_NUM.
Here is a sample of the data from table: 133334_0215_WITHOUT_INV
pat name dept Loc ccmc # visit type apt date
GARUTI,JESSICA J HEM CCM 115920 FUV 8/25/2005
GARUTI,JESSICA J HEM CCM 115920 FUV 10/13/2005
SULLIVAN,JACKIE PRIM CCM 115925 NEW 02/01/2005
MOORE,CATHERINE ENDO CCM 115325 FUV 06/20/2005
Here is a sample of that data from table: 133334_0215_JUST_INV
ccmc # dos inv #
115920 08/25/2005 775001
115325 06/20/2005 775005
So the invoice #'s should be added to the names from above: Garuti, Jessica for apt date 08/25/05
and for Moore,Catherine for apt date 06/20/05
The other two lines Garuti, Jessica for apt date 10/13/05 and Jackie Sullivan for apt date 02/01/05 should still be listed in my final output, but without invoice numbers.
Can you provide the correct sql, or help me to get the correct number of records back - 59,919 (some with invoice numbers, so without)
Please let me know if you need anything further from me....
Thanks,
Christine