Query - how to join?

  • Thread starter Thread starter SAC
  • Start date Start date
S

SAC

I have two tables: tblGLMas (General Ledger Master) and tblGLJrn (General
Ledger Journal).

tblGHLJrn is the child.

I want a query that will return records from tblGLMas that have YTD <>0 and
I want all records from tblGLJrn which are dated between [Begin] and [End]
(Even if the YTD amt of the related GLMas account does not have a YTD amt)

How do I do this?

Thanks.
 
-----Original Message-----
I have two tables: tblGLMas (General Ledger Master) and tblGLJrn (General
Ledger Journal).

tblGHLJrn is the child.

I want a query that will return records from tblGLMas
that have YTD said:
I want all records from tblGLJrn which are dated between [Begin] and [End]
(Even if the YTD amt of the related GLMas account does not have a YTD amt)

How do I do this?

Thanks.






.
Assuming that you mean your YTD is stored in tblGLMAS and
that tblGLJRN holds the detail records. You will want your
join to include all records from tblGLMAS and only those
from tblGLJRN which match. Then in your criteria for the
YTD field you will just need <> 0

This will skip any GLMas records which have a zero in the
ytd field. It will also skip any GLMas recs which do not
have any details in GLJrn (by definition the ytd should be
zero in this case). If you leave off the criteria you will
get everything except orphan records in the tblGLJRN.
 
Thanks. I've have that part figured out, however...

Sometimes the detail - the journal - has records for accounts which don't
have YTD amounts in the GLMAS. (The account is used the first time in the
current month.)

That's what I don't know how to handle.

Ernie said:
-----Original Message-----
I have two tables: tblGLMas (General Ledger Master) and tblGLJrn (General
Ledger Journal).

tblGHLJrn is the child.

I want a query that will return records from tblGLMas
that have YTD said:
I want all records from tblGLJrn which are dated between [Begin] and [End]
(Even if the YTD amt of the related GLMas account does not have a YTD amt)

How do I do this?

Thanks.






.
Assuming that you mean your YTD is stored in tblGLMAS and
that tblGLJRN holds the detail records. You will want your
join to include all records from tblGLMAS and only those
from tblGLJRN which match. Then in your criteria for the
YTD field you will just need <> 0

This will skip any GLMas records which have a zero in the
ytd field. It will also skip any GLMas recs which do not
have any details in GLJrn (by definition the ytd should be
zero in this case). If you leave off the criteria you will
get everything except orphan records in the tblGLJRN.
 
Back
Top