Solved

SQL string

Posted on 1998-11-18
7
172 Views
Last Modified: 2010-04-04
In a Query component I have a SQL string :
select sum(price) from customer
What do I write to add one field more?
I have tried many ways like:
select date sum(price) from Customer
and
select date and sum(price) from Customer
0
Comment
Question by:rainbowsoftware
7 Comments
 

Expert Comment

by:hpw
ID: 1347190
Hello,

I think you should try this:

Select Date, Sum(price) from Customer

Hubert

0
 

Author Comment

by:rainbowsoftware
ID: 1347191
select date, sum(price) from customer does not work.

I want to sum the field Price and it's OK with
select sum(price) from Customer
But when writing
select Date, sum(price) from customer group by date
the SumOfPrice shows the value of the current record and not the sum of all.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1347192
hi rainbowsoftware,

you cannot have fields and the sum of all in a normal sql-statement but in a nested subquery should it go :

select date, sumoverall from customer, (select sum(price) as sumoverall from customer)

but each line holds now the total sum

meikl
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:dwwang
ID: 1347193
Tell me what do you want to have as the result dataset, and I can tell you how to do that.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1347194
Hello?
0
 

Author Comment

by:rainbowsoftware
ID: 1347195
The answer from hpw is not useable.
The answer from Kretzchmar has helped me to do the job.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 1347196
hi rainbowsoftware,

well then give me the points

what is going on with your q:
http://www.experts-exchange.com/Q.10097306

meikl
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to define IfThen functions in one common unit? 4 62
DBCtrlGrid, Delphi, Scroll 8 55
Delphi Seattle StructureView color 1 21
Broadcast a message using ICS 2 20
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question