anglophobe
Technical User
I am trying to join several tables through inner and left joins.
[tt]
Problem:
Prob# Type Date
01 KE Jan 01
02 P Jan 05
Incident
Inc# Date Plink
01 Jan 03 01
02 Jan 07 01
03 Jan 11 02
Audit
Parent_Link FN
01 TypeOfProblem
01 Status
02 Status
What I need to end up with is:
Prob# Type PDate FN Inc# IDate
01 KE Jan 01 Type 01 Jan 03
01 KE Jan 01 Type 02 Jan 07
02 P Jan 05 03 Jan 11
[/tt]
So far I can do the problem and incident parts, but am unable to get the Audit/FieldName part working
My code I was attempting is this: (you can ignore the FusionLink table, that bit works fine)
But it gives me an error. Taking out the WHERE expression works. Any suggestions?
I’m on CR10, and do not have access to the db, just a generic connection.
[tt]
Problem:
Prob# Type Date
01 KE Jan 01
02 P Jan 05
Incident
Inc# Date Plink
01 Jan 03 01
02 Jan 07 01
03 Jan 11 02
Audit
Parent_Link FN
01 TypeOfProblem
01 Status
02 Status
What I need to end up with is:
Prob# Type PDate FN Inc# IDate
01 KE Jan 01 Type 01 Jan 03
01 KE Jan 01 Type 02 Jan 07
02 P Jan 05 03 Jan 11
[/tt]
So far I can do the problem and incident parts, but am unable to get the Audit/FieldName part working
My code I was attempting is this: (you can ignore the FusionLink table, that bit works fine)
Code:
SELECT Prob.ProblemNumber, Inc.IncidentNumber, Prob.TypeOfProblem, Prob.CreatedDateTime, Inc.CreatedDateTime, Aud.FieldName
FROM (((dbo_Problem Prob
INNER JOIN dbo_FusionLink Fus ON Prob.RecId=Fus.TargetID)
INNER JOIN dbo_Incident Inc ON Inc.RecId=Fus.SourceID)
LEFT JOIN dbo_AuditHistory Aud ON Aud.ParentLink_RecID = Prob.RecID WHERE Aud.FieldName = "TypeofProblem")
ORDER BY Prob.ProblemNumber
I’m on CR10, and do not have access to the db, just a generic connection.