Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: How does sub report query works?? Post Reply Post New Topic
Author Message
sur200
Newbie
Newbie
Avatar

Joined: 18 Feb 2009
Location: India
Online Status: Offline
Posts: 11
Quote sur200 Replybullet Topic: How does sub report query works??
     Posted: 24 Feb 2009 at 5:00am
Hi again,
 
I would like to know the working of sub report queries.
 
main report query:
select *,recid from myTable where recid={?parameterRecID}
 
Sub report query:
select *,recIdChild from myChildTable
 
sub report is linked as
{command.recIDChild} = {?Pm-command.recID}
 
 
now the question will
select *,recIdChild from myChildTable
query run first and will return all the records from the myChildTable and then will filter the records based on the condition used for linking?
or
will it fetch only the matching records from the SQL for the condition used for linking.
 
 
because if it will fetch all the records from the SQL and then will filter the records based on the report link condition then there will be performance issue because i am fetching all the records and then showing only some of those which is definitely not a right way.
 
 
Please if someone know then explain it.
 
TIA,
Surinder Singh
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 24 Feb 2009 at 6:54am
If I remember, the main report will call the subreport, which will go out and select the data it needs, so it only fetches what the subreport needs.
 
Either way subreports give a performance hit, as a 100 row report will hit the database 101 times, but it is better than your first scenario.
 
Hope this helps
IP IP Logged
sur200
Newbie
Newbie
Avatar

Joined: 18 Feb 2009
Location: India
Online Status: Offline
Posts: 11
Quote sur200 Replybullet Posted: 24 Feb 2009 at 7:40am
thanks for your comments!
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