Print Page | Close Window

SQL Query

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=13675
Printed Date: 22 Apr 2025 at 9:33pm


Topic: SQL Query
Posted By: cfuller510
Subject: SQL Query
Date Posted: 06 Jul 2011 at 3:54am
I have a report that is using 2 tables, 3 views and 1 stored procedure.  I need to be able to document the SQL Query behind the report, but when I open the Show SQL Query box, only one of the tables is displayed as being used.  However, when I go to the Database Expert, all the tables are listed and showed as linking in the Links tab.  Is there a reason why they are not showin in the SQL Query box?



Replies:
Posted By: DBlank
Date Posted: 06 Jul 2011 at 4:50am
if you are not enforcing joins in crystal and are not using any fields from any of these other tables they are not part of the query.


Posted By: cfuller510
Date Posted: 06 Jul 2011 at 4:54am

There are fields used within the report and in the formulas from all tables/views/procedure. 



Posted By: sharona
Date Posted: 06 Jul 2011 at 4:58am
you know you cant join tables to views and sp in one report in crystal youll get an error. you need to either create a sub report to pull the view data
and a sub for the sp. then join them on the link you were going to in the main report.


-------------
sharona


Posted By: cfuller510
Date Posted: 06 Jul 2011 at 5:01am
It does run the way it is set up.  This is a report that was created by someone else, so I'm not sure if there is anything else behind the report. 


Posted By: DBlank
Date Posted: 06 Jul 2011 at 6:30am

Hmmm,

Not sure why this is. You are not using sub reports correct?


Posted By: cfuller510
Date Posted: 06 Jul 2011 at 6:37am
Correct, there are no sub-reports used. 


Posted By: DBlank
Date Posted: 06 Jul 2011 at 6:41am
odd.
you can verify the DB, run the report, refresh the repotr and everything still works but the Database >Show SQL Query is still omitting everyhing but one table?


Posted By: sharona
Date Posted: 06 Jul 2011 at 6:52am
if you dont have the joins it will only pick up the first table it sees
and i think you should re design the report, it is probably cumbersome because with out joins it pulls all the records from every table, view, sp it uses.


-------------
sharona



Print Page | Close Window