Hi there

I have the the following database structure:

Table Product
Product_ID - Product_name - Product_issue_date

Table Sale
Product_ID - amount - date

Now i want to report the total of each product.
The result should look like this:

Product 1 - 5,000
Product 2 - 3,500
Product 3 - 4,430

How can i do that?

I tried it with a running total field, like

[product_name] - [#total]

But then the result looked like

Pruduct 1 - 500
Product 1 - 4500
Product 2 - 3000
Product 2 - 500
Product 3 - 4000
Product 3 - 430

So basically it should read out all Product names and then
calculate the totals for each product.

Thanx for the help.

Flinn

Hi
Hope I can be of help. But I use Fast Report and if I want to do what you have done, I use the following :
[Sum(<Sales."Description">*<Sales."Total">)]
And then it comes out like you have described. Hope this will help somehow.

what you mean by: <Sales."Description"> ?

and im not sure if it works the same in crystal reports...

Hi,
That means the name of the product. You call it Product_ID. I hope it can give you an idea on how to try it, you just change the names and signs. But if it cant work, then they are different, but its worthy trying I think.

ok thanx for the hint. ill try it out. But now just a basic question:

Im using a OLE DB (ADO) connection to my sql database.
I created some SQL expression fields that query the database
for diffrent totals from diffrent tables. If i use just one query, the
results will be shown. But if i use more then one (from diffrent tables), no result at all will be shown.

Do i have to use datasets?? or create groups?

I would prefer to be able to create sql expression fields
to simple query the database as i want.

Flinn

Hi,
You have to create groups.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.