I have 3 tables:
Aliases: DefendantID, Alias
Defendant: DefendantID, Name
Citations: CitationNo, DefendantID, CitationDetails
I created two queries and they sort of work ...
1) In my first query, I do a union between Aliases and DefendantID to get all the DefendantIDs for a defendant.
qryFindAlias:
Select defendantid
From defendant
where defendantid = "TBTRoberts"
UNION
select alias from aliases
where defendantid = "TBTRoberts";
Problems with qryFindAlias: I need to set it up so I can pass a control from my form rather than a hardcoded value.
2) In my next query, I select from Defendant, Citations, and qryFindAlias
qryAllCitations:
Select C.CitationNo, C.DefendantID, C.CitationDetails, D.Name
FROM (Defendant D INNER JOIN Citations C ON D.DefendantID=C.DefendantID) INNER JOIN qryFindAlias ON D.DefendantID=Alias.defendantid;
I get confused with join sometimes, so using where clause: FROM defendant d, citation c, alias
where d.defendantid = c.defendantid
and alias.defendantid = d.defendantid
Is what I'm attempting to do even possible?
Aliases: DefendantID, Alias
Defendant: DefendantID, Name
Citations: CitationNo, DefendantID, CitationDetails
I created two queries and they sort of work ...
1) In my first query, I do a union between Aliases and DefendantID to get all the DefendantIDs for a defendant.
qryFindAlias:
Select defendantid
From defendant
where defendantid = "TBTRoberts"
UNION
select alias from aliases
where defendantid = "TBTRoberts";
Problems with qryFindAlias: I need to set it up so I can pass a control from my form rather than a hardcoded value.
2) In my next query, I select from Defendant, Citations, and qryFindAlias
qryAllCitations:
Select C.CitationNo, C.DefendantID, C.CitationDetails, D.Name
FROM (Defendant D INNER JOIN Citations C ON D.DefendantID=C.DefendantID) INNER JOIN qryFindAlias ON D.DefendantID=Alias.defendantid;
I get confused with join sometimes, so using where clause: FROM defendant d, citation c, alias
where d.defendantid = c.defendantid
and alias.defendantid = d.defendantid
Is what I'm attempting to do even possible?