Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query problem

Status
Not open for further replies.

elibb

Programmer
Oct 22, 2001
335
MX
hi, i have two reports... one for incomes and one for outcomes, is it possible to.. make a third one, that will calculate the sum of both??
like the main total, incomes - outcomes??

well actualli i want to do this:

ive been trying a while to get both in the same report, but i cannt get the sql to work.
it is like this:
i have to tables, one for incomes and one for outcomes.
each has a product code, quantity and total. its very simple.
my problem is that sometimes there are more outcomes and incomes or viceversa. and i want them grouped, like incomes frist, and outcomes later, and then get the grantotal. i just cannt make it work..

i think it must be very easy, but i cannt figure it out any ideas??

thank you very very much.
 
Insert one in the other as a subreport. If you need to make grand totals with values from both reports, you will need to use shared variables to do this. Software Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Other approaches might be to either create a third table. which has the combination of the 2 tables, or manually edit the SQL to create a Union.

Then you can create a formula which is akin to:

If income > 0 (or whatever qualifies them) then
'Incomes'
else
'Outcomes'

Now group on this field.

You'll now get the equivalent of 2 reports (grouping and totaling by the above), and you can add in summary totals for the equivalent of the third report.

-k kai@informeddatadecisions.com
 
I'm an SQL programmer and am trying to assist our Crystal Reports writer getting the data out of the database. Is there a way to manually compose the SQL statement for a query in Crystal. I see you mentioning "manually edit the SQL.." in this thread but the only thing we've been able to do is edit the where clause of the sql query. Is there a way to use a completly custom SQL query?

thanks
tonic
 
If you write and save your own custom sql, you can point Crystal to it by picking the query in the Data Explorer. (Database / Set Location in an existing report).

Naith
 
mm i usually put the sql manualy, i do it like this:
on the form that contains the CRViwer, i put this:

Report.SQLqueryString="Select .... "

thats it.

oh, and about my reports, i fixed it with a dataEnvironment, using an union, thank you very very much.

Eli
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top