Link to home
Start Free TrialLog in
Avatar of Roberto Madro R.
Roberto Madro R.Flag for United States of America

asked on

Emulate a Crystal Report using SQL Query.

I have a Crystal report with one field based on a Subreport, in the subreport I do a count and only pull that COUNT  into the main report, replacing the whole report with SQL is straightforward, but I'm questioning my approach to replacing the subreport part with a subquery as the results I got this far are sketchy. How would you approach it?
SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ah yes, of course, window functions are are damn fine choice
Avatar of Roberto Madro R.

ASKER

To help explain better I'm including this graphic, I can select & manipulate info from the "DeliveryTable" & "CustomerInfoTable" and what have you, but I want to embed the total number of Orders by counting them and by Grouping On the CustomerID from the OrderMasterTable, then plug that number in my query of the other tables.User generated image
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike McCracken
Mike McCracken

Does this have anything to do with Crystal Reports other than you are trying to match the results of an existing report?

Do you want a query you can use as a Command in Crystal?

mlmcc
No mlmcc, my crystal runs fine, except it's far reaching and takes long time to finish running, that's why I opted to base it on a sql query.
Many thanks experts, the collective input from both was valuable even if I didn't use either of your solutions for this exact project, I, however used an old script you slightwv helped me on, and it's goes as follows;


With
A As(
        select column A, column B, from table X,  where X = Y,  Group By XX...),
B As(
        select column C, column D from table Y, where N like 'abc123"),
Select
        A.A,
        A.B,
       B.C,
       B.D
From A
      Inner Join B on A.A = B.C
      ........


Many thanks for your help.