cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports Linking with an OR

former_member217514
Active Contributor
0 Kudos

I need to be able to link two tables with an OR.

SELECT T0.OcrCode, SUM(T1.Debit), SUM(T1.Credit)

FROM OOCR T0

INNER JOIN JDT1 T1 ON T1.ProfitCode = T0.OcrCode OR T1.OcrCode2 = T0.OcrCode OR T1.OcrCode3 = T0.OcrCode

GROUP BY T0.OcrCode

Is there a way to Link two tables with an OR clause?

I know there is a way to add this as a command and link other tables to it, but I prefer to have crystal link the tables so I have the data available in the future if my customer wants changes.  So I am looking for another solution than adding a command to the report.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Jeff..........

You can use Case When conditions in between.......

Regards,

Rahul

KennedyT21
Active Contributor
0 Kudos

HI Jeff,

Yes , you can Link with or condition .

Try this

SELECT T0.OcrCode, SUM(T1.Debit), SUM(T1.Credit)

FROM OOCR T0

INNER JOIN JDT1 T1 ON (T1.ProfitCode = T0.OcrCode OR T1.OcrCode2 = T0.OcrCode OR T1.OcrCode3 = T0.OcrCode)

GROUP BY T0.OcrCode

Or By

SELECT T0.OcrCode, SUM(T1.Debit), SUM(T1.Credit)

FROM OOCR T0

INNER JOIN JDT1 T1 ON T1.ProfitCode = T0.OcrCode

INNER JOIN JDT1 T2 on T2.OcrCode2 = T0.OcrCode

INNER JOIN JDT1 T3 on T3.OcrCode3 = T0.OcrCode

GROUP BY T0.OcrCode

Regards

Kennedy