davidhexter
Programmer
In the below query, I have two fields (loan.ccmpy_id and the loan.scmpy_id) that relate to the company table's company.cmpy_id field. Pulling in the cmpy_name for the first cmpy_id was simple enough, but I am having difficulty pulling in the company name for the scmy_id field?
How do I do that?
SELECT RTRIM(LTRIM(company.cmpy_name)) AS Creditor,cloanid AS 'Creditor Loan #',scmpy_id AS 'Servicing Agent',sloanid AS [Servicer's Loan #],CONVERT(char(10),closedate,101) AS 'Closing Date',CONVERT(char(10),maturitydate,101) AS 'Maturity Date',CONVERT(char(10),balldate ,101) AS 'Balloon Payment Date'
FROM loan
INNER JOIN company ON (company.cmpy_id = loan.ccmpy_id)
WHERE maturitydate < GETDATE() AND retired <>'Y'
ORDER BY maturitydate
Thanks for your assistance.
Dave
How do I do that?
SELECT RTRIM(LTRIM(company.cmpy_name)) AS Creditor,cloanid AS 'Creditor Loan #',scmpy_id AS 'Servicing Agent',sloanid AS [Servicer's Loan #],CONVERT(char(10),closedate,101) AS 'Closing Date',CONVERT(char(10),maturitydate,101) AS 'Maturity Date',CONVERT(char(10),balldate ,101) AS 'Balloon Payment Date'
FROM loan
INNER JOIN company ON (company.cmpy_id = loan.ccmpy_id)
WHERE maturitydate < GETDATE() AND retired <>'Y'
ORDER BY maturitydate
Thanks for your assistance.
Dave