Discussion:
here's another join question
(too old to reply)
mcnewsxp
2013-02-25 14:44:49 UTC
Permalink
tableA
----------
recid searchkeyfield

tableB
------------
recid tableArecid reporttypeid reportdate

tableC
------------
recid searchkeyfield reporttypeid reportdate

so I want rows from tableB and TableC that contain the reporttype and reportdate
on their own row

how?

tia,
mcnewsxp
mcnewsxp
2013-02-25 15:36:58 UTC
Permalink
SELECT a.LetterDate, LetterTypeLkup.LetterDescription
FROM CLetterHistory b INNER JOIN
LetterHistory a ON b.LetterID = a.RecID INNER JOIN
LetterTypeLkup ON a.LetterType = LetterTypeLkup.LetterTypeID
WHERE b.CID = @cid
UNION
SELECT LetterDate, LetterTypeLkup.LetterDescription
FROM LetterHistoryLog c INNER JOIN
LetterTypeLkup ON c.LetterTypeID = LetterTypeLkup.LetterTypeID
WHERE c.CID = @cid

Continue reading on narkive:
Loading...