B
BillA
Having problems with multiple records being returned as I attempt to build
this query.
Here are my 3 tables with key fields:
(leading underscores added for viewing)
___tbl_Project
ProjectID (pk)
Status {open, closed etc…}
With 1:M relationship to
__tbl_RenewORAmend
RenewAmendID (pk)
ProjectID (fk)
DateReceived {date field}
RenewAmend {cbo - choice between Renew or Amend}
With 1:M relationship to
__tbl_RenewAmendComments
CommentID (pk)
RenewAmendID (fk)
IssueDate {date of comment / issue}
Issue {text field}
__tbl_Project contains information about the project;
__Tbl_RenewORAmend contains information about project renewals and
amendments – each new date in the DateReceived field represents a new renewal
or amendment to the project (a project may have many renewals and/or
amendments);
__Tbl_RenewAmendComments captures comments to a renewal or amendment
(renewal and an amendment may have many comments)
My goal is to create a query that gives me all projects that are “open,†and
if there is an renewal or amendment, indicate which ie; "Renew" provide the
most recent “DateReceived†and then – the most recent “Issue†entered (for
the DateReceived record).
I have the SQL for capturing the TOP Issue, where I concatenate the
IssueDate & Issue fields. This is what the SQL looks like:
Issue: (SELECT TOP 1 (tbl_RenewAmendComments!IssueDate & ": " &
tbl_RenewAmendComments!Issue) FROM tbl_RenewAmendComments
WHERE tbl_RenewAmendComments.RenewAmendID =
tbl_RenewORAmend.RenewAmendID ORDER BY
tbl_RenewAmendComments.IssueDate DESC)
I have been struggling to create the query (or pre/sub queries) that don’t
give me multiple instances of records.
Any advice or suggestions would be appreciated.
Thanks,
Bill
this query.
Here are my 3 tables with key fields:
(leading underscores added for viewing)
___tbl_Project
ProjectID (pk)
Status {open, closed etc…}
With 1:M relationship to
__tbl_RenewORAmend
RenewAmendID (pk)
ProjectID (fk)
DateReceived {date field}
RenewAmend {cbo - choice between Renew or Amend}
With 1:M relationship to
__tbl_RenewAmendComments
CommentID (pk)
RenewAmendID (fk)
IssueDate {date of comment / issue}
Issue {text field}
__tbl_Project contains information about the project;
__Tbl_RenewORAmend contains information about project renewals and
amendments – each new date in the DateReceived field represents a new renewal
or amendment to the project (a project may have many renewals and/or
amendments);
__Tbl_RenewAmendComments captures comments to a renewal or amendment
(renewal and an amendment may have many comments)
My goal is to create a query that gives me all projects that are “open,†and
if there is an renewal or amendment, indicate which ie; "Renew" provide the
most recent “DateReceived†and then – the most recent “Issue†entered (for
the DateReceived record).
I have the SQL for capturing the TOP Issue, where I concatenate the
IssueDate & Issue fields. This is what the SQL looks like:
Issue: (SELECT TOP 1 (tbl_RenewAmendComments!IssueDate & ": " &
tbl_RenewAmendComments!Issue) FROM tbl_RenewAmendComments
WHERE tbl_RenewAmendComments.RenewAmendID =
tbl_RenewORAmend.RenewAmendID ORDER BY
tbl_RenewAmendComments.IssueDate DESC)
I have been struggling to create the query (or pre/sub queries) that don’t
give me multiple instances of records.
Any advice or suggestions would be appreciated.
Thanks,
Bill