Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Joining tables returns too much data Post Reply Post New Topic
Author Message
stanley721
Newbie
Newbie
Avatar

Joined: 12 Jul 2011
Location: United States
Online Status: Offline
Posts: 8
Quote stanley721 Replybullet Topic: Joining tables returns too much data
     Posted: 18 Jul 2011 at 2:40am
I have a report that pulls data from multiple tables. One of the pieces of data needs to be changed. I have tried changing the links to the data and I keep getting about 10 times the records of returns than what was previously being returned.
 Here is the sql query that is current. What I need is to change the "noc_attachment_viewed"."noc_attachment_viewed" to table "user_messages.message_acknowledged". Seems simple but the links are what looks like they are messing up.
SELECT "noc_attachment_viewed"."noc_attachment_viewed", "userlog"."name", "notice_of_change"."notice_of_change_text", "notice_of_change"."notice_of_change_title"
 FROM   (("eSOMS"."dbo"."noc_attachment_viewed" "noc_attachment_viewed" INNER JOIN "eSOMS"."dbo"."notice_of_change_documents" "notice_of_change_documents" ON ("noc_attachment_viewed"."notice_of_change_id"="notice_of_change_documents"."notice_of_change_id") AND ("noc_attachment_viewed"."document_number"="notice_of_change_documents"."document_number")) INNER JOIN "eSOMS"."dbo"."userlog" "userlog" ON "noc_attachment_viewed"."user_id"="userlog"."user_id") INNER JOIN "eSOMS"."dbo"."notice_of_change" "notice_of_change" ON "notice_of_change_documents"."notice_of_change_id"="notice_of_change"."notice_of_change_id"

 ORDER BY "notice_of_change"."notice_of_change_title", "userlog"."name"

 


 

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Jul 2011 at 11:10am
I am going to guess your new table addition has multiple version of the same row with new dates associated per row.
If you can use a view or stored proc you can join it in using a maximum value (or use a crystal command to mimic that process)
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