on 08-03-2012 4:22 PM
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.
Hi Jeff..........
You can use Case When conditions in between.......
Regards,
Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.