Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: many-to-many relationship: what to do? Post Reply Post New Topic
Author Message
JoyceW
Newbie
Newbie


Joined: 26 Aug 2010
Location: Netherlands
Online Status: Offline
Posts: 3
Quote JoyceW Replybullet Topic: many-to-many relationship: what to do?
     Posted: 27 Aug 2010 at 12:01am
Hi All,

I've recently started working with CR2008 and I've run into a problem. I need to make a report that compares the results of two different tables from two different databases.

One is an exact database, which I link to directly. The other is an access database that I can modify a little.

Both databases have one field in common, which is the journal number. In each database the journal number appears on several rows (in one there are multiple invoice numbers with the same journal number, in the other multiple cost centers) There is no other relation between the two tables than the journal number.

So, of course linking these two in CR will result in multiple data fields.

I figured a solution would be summing up the table from Exact, but since I have no access to that database that should be done in Crystal. I thought I could use sql for that, but i'm not very knowledgeable in sql. I copied this from Access into sql expression in CR:

SELECT LEDTRS.POSTING_NR, LEDTRS.ACC_NR, LEDTRS.PERIOD, Sum(LEDTRS.AMT_DEF_CUR) AS SumOfAMT_DEF_CUR, Sum(LEDTRS.AMT_CUR) AS SumOfAMT_CUR, Sum(LEDTRS.VAT_AMT_3) AS SumOfVAT_AMT_3
FROM LEDTRS
GROUP BY LEDTRS.POSTING_NR, LEDTRS.ACC_NR, LEDTRS.PERIOD
HAVING (((LEDTRS.ACC_NR)>"5*"));


But alas, CR doesn't recognize the commands and I have no idea what to adjust or if this even is a viable solution.

Any help is very much appreciated.

Sincerely, Joyce



                        
IP IP Logged
Jim257
Newbie
Newbie
Avatar

Joined: 17 Aug 2010
Online Status: Offline
Posts: 6
Quote Jim257 Replybullet Posted: 27 Aug 2010 at 1:58am
So it sounds like you've added that SQL that you copied to a Command within the Crystal report file?

You could use SQL Commands to select from both of the different DBs and connect them together using Links in Database Expert.

The SQL statement above is doing some summing of data:

Sum(LEDTRS.AMT_DEF_CUR)
Sum(LEDTRS.AMT_CUR)
and
Sum(LEDTRS.VAT_AMT_3)

for all records that have LEDTRS.ACC_NR > "5*"
I'd say the "5*" is not Exact syntax?

What error message are you getting?




IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum