how to extract last n records using subreport in crystal report 11?

Concern Support
Concern Support used Ask the Experts™
on
hi,

i have two table in sql server StudentInfo and Studentfee. i have a main report which takes data from studentinfo and a subreport which takes data from student fee.

each student has thousands records in studentfee, which is very expensive to place in subreport. Is there any way where i pass 20 or N in a parameter to subreport and it retrieves only last N records. if it is possible using subreport wizard then it will be very good.

Thanks,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
How do you extract records for the StudentFee?

Priya PerumpilavilSoftware Engineer

Commented:
you can create the subreport through stored procedure right...there u give the query for last n records
Most Valuable Expert 2012
Top Expert 2014
Commented:
You can modify your query to something like

Select Top 20 * From StudentFee Order By FeeID Desc
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013
Commented:
Assuming you have CR9 or later, you can use a COMMAND for the data source, with SQL as above fromm CodeCruiser.

You can also use the GROUP SORT EXPERT to change the current report into a TOP N.

mlmcc
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial