G
Guest
Below is an SQL asks me to enter a perameter value for X.MBFAM# every time I
try to run this query. I have written several other SQL's just like this
that have worked nicely. The PK for the C47FILES_TRANS table is TRFAM# and
the PK for the C47FILES_MEMBR table is MBFAM# and has a 1 to 1 relationship
from MBFAM# to TRFAM#. My goal is this, there can be multiple TRTDAT (which
is a date field in text format) for one MBFAM#. I only want to see the
oldest TRTDAT for each MBFAM#. I was sure I wrote this part of the SQL
correctly,
=SELECT MIN(X.[TRTDAT]) FROM C47FILES_TRANS AS X WHERE
X.[MBFAM#]=[C47FILES_MEMBR].[MBFAM#])
but I guess I was wrong. I hope this is not to much information to read and
any help is greatly apprieciated.
SELECT C47FILES_TRANS.TRTDAT, C47FILES_MEMBR.[MBFAM#],
C47FILES_MEMBR.MBFRST, C47FILES_MEMBR.MBLAST, C47FILES_FCLAS.FCNUM,
C47FILES_FCLAS.FCDESC, C47FILES_MEMBR.MBLOC, C47FILES_LOC.LONAME,
C47FILES_TRANS.TRAMT, Format$([TRTDAT],"MMMM YYYY") AS MonthYear,
Format$([TRTDAT],"dd") AS [Day], Format$([TRTDAT],"MM") AS [Month],
Format$([TRTDAT],"YYYY") AS [Year]
FROM ((C47FILES_FAMLY INNER JOIN C47FILES_FCLAS ON C47FILES_FAMLY.FMCLAS =
C47FILES_FCLAS.FCNUM) INNER JOIN (C47FILES_DOCTR INNER JOIN (C47FILES_LOC
INNER JOIN C47FILES_MEMBR ON C47FILES_LOC.LONUM = C47FILES_MEMBR.MBLOC) ON
(C47FILES_DOCTR.DRNUM = C47FILES_MEMBR.MBATDR) AND (C47FILES_DOCTR.DRLOC =
C47FILES_LOC.LONUM)) ON C47FILES_FAMLY.FMNUM = C47FILES_MEMBR.[MBFAM#]) INNER
JOIN C47FILES_TRANS ON (C47FILES_MEMBR.[MBFAM#] = C47FILES_TRANS.[TRFAM#])
AND (C47FILES_FAMLY.FMNUM = C47FILES_TRANS.[TRFAM#])
GROUP BY C47FILES_TRANS.TRTDAT, C47FILES_MEMBR.[MBFAM#],
C47FILES_MEMBR.MBFRST, C47FILES_MEMBR.MBLAST, C47FILES_FCLAS.FCNUM,
C47FILES_FCLAS.FCDESC, C47FILES_MEMBR.MBLOC, C47FILES_LOC.LONAME,
C47FILES_TRANS.TRAMT, Format$([TRTDAT],"MMMM YYYY"), Format$([TRTDAT],"dd"),
Format$([TRTDAT],"MM"), Format$([TRTDAT],"YYYY")
HAVING (((C47FILES_TRANS.TRTDAT)=(SELECT MIN(X.[TRTDAT]) FROM C47FILES_TRANS
AS X WHERE X.[MBFAM#]=[C47FILES_MEMBR].[MBFAM#])))
ORDER BY C47FILES_TRANS.TRTDAT;
This SQL asks me to enter a perameter value for X.MBFAM# every time I try to
run this query. I have written severl other SQL's just like this that have
worked. The PK for the C47FILES_TRANS table is TRFAM# and the PK for the
C47FILES_MEMBR table is MBFAM# and has a 1 to 1 relationship from MBFAM# to
TRFAM#. My goal is this, there can be multiple TRTDAT (which is a date field
in text format) for one MBFAM#. I only want to see the oldest TRTDAT for
each MBFAM#. I was sure I wrote this part of the SQL correctly,
=SELECT MIN(X.[TRTDAT]) FROM C47FILES_TRANS AS X WHERE
X.[MBFAM#]=[C47FILES_MEMBR].[MBFAM#])
but I guess I was wrong. I hope this is not to much information to read and
any help is greatly apprieciated.
try to run this query. I have written several other SQL's just like this
that have worked nicely. The PK for the C47FILES_TRANS table is TRFAM# and
the PK for the C47FILES_MEMBR table is MBFAM# and has a 1 to 1 relationship
from MBFAM# to TRFAM#. My goal is this, there can be multiple TRTDAT (which
is a date field in text format) for one MBFAM#. I only want to see the
oldest TRTDAT for each MBFAM#. I was sure I wrote this part of the SQL
correctly,
=SELECT MIN(X.[TRTDAT]) FROM C47FILES_TRANS AS X WHERE
X.[MBFAM#]=[C47FILES_MEMBR].[MBFAM#])
but I guess I was wrong. I hope this is not to much information to read and
any help is greatly apprieciated.
SELECT C47FILES_TRANS.TRTDAT, C47FILES_MEMBR.[MBFAM#],
C47FILES_MEMBR.MBFRST, C47FILES_MEMBR.MBLAST, C47FILES_FCLAS.FCNUM,
C47FILES_FCLAS.FCDESC, C47FILES_MEMBR.MBLOC, C47FILES_LOC.LONAME,
C47FILES_TRANS.TRAMT, Format$([TRTDAT],"MMMM YYYY") AS MonthYear,
Format$([TRTDAT],"dd") AS [Day], Format$([TRTDAT],"MM") AS [Month],
Format$([TRTDAT],"YYYY") AS [Year]
FROM ((C47FILES_FAMLY INNER JOIN C47FILES_FCLAS ON C47FILES_FAMLY.FMCLAS =
C47FILES_FCLAS.FCNUM) INNER JOIN (C47FILES_DOCTR INNER JOIN (C47FILES_LOC
INNER JOIN C47FILES_MEMBR ON C47FILES_LOC.LONUM = C47FILES_MEMBR.MBLOC) ON
(C47FILES_DOCTR.DRNUM = C47FILES_MEMBR.MBATDR) AND (C47FILES_DOCTR.DRLOC =
C47FILES_LOC.LONUM)) ON C47FILES_FAMLY.FMNUM = C47FILES_MEMBR.[MBFAM#]) INNER
JOIN C47FILES_TRANS ON (C47FILES_MEMBR.[MBFAM#] = C47FILES_TRANS.[TRFAM#])
AND (C47FILES_FAMLY.FMNUM = C47FILES_TRANS.[TRFAM#])
GROUP BY C47FILES_TRANS.TRTDAT, C47FILES_MEMBR.[MBFAM#],
C47FILES_MEMBR.MBFRST, C47FILES_MEMBR.MBLAST, C47FILES_FCLAS.FCNUM,
C47FILES_FCLAS.FCDESC, C47FILES_MEMBR.MBLOC, C47FILES_LOC.LONAME,
C47FILES_TRANS.TRAMT, Format$([TRTDAT],"MMMM YYYY"), Format$([TRTDAT],"dd"),
Format$([TRTDAT],"MM"), Format$([TRTDAT],"YYYY")
HAVING (((C47FILES_TRANS.TRTDAT)=(SELECT MIN(X.[TRTDAT]) FROM C47FILES_TRANS
AS X WHERE X.[MBFAM#]=[C47FILES_MEMBR].[MBFAM#])))
ORDER BY C47FILES_TRANS.TRTDAT;
This SQL asks me to enter a perameter value for X.MBFAM# every time I try to
run this query. I have written severl other SQL's just like this that have
worked. The PK for the C47FILES_TRANS table is TRFAM# and the PK for the
C47FILES_MEMBR table is MBFAM# and has a 1 to 1 relationship from MBFAM# to
TRFAM#. My goal is this, there can be multiple TRTDAT (which is a date field
in text format) for one MBFAM#. I only want to see the oldest TRTDAT for
each MBFAM#. I was sure I wrote this part of the SQL correctly,
=SELECT MIN(X.[TRTDAT]) FROM C47FILES_TRANS AS X WHERE
X.[MBFAM#]=[C47FILES_MEMBR].[MBFAM#])
but I guess I was wrong. I hope this is not to much information to read and
any help is greatly apprieciated.