February 13, 2009 at 11:25 am
These error messages are pretty clear.
Read the error messages then look at your query.
February 13, 2009 at 11:48 am
suresh,
Try this: -
select OrderFormNo
,ClientName
,OrderDate
,Product
,sum(Value)
,InvoiceQuantity
,PendingQuantity
from AOM_Tbl_PendingOrders
group by OrderFormNo, ClientName,OrderDate,Product,InvoiceQuantity,PendingQuantity
In your case, remember that whenever you use the group by clause you need to add all the other colums as well except the function column (i.e. sum)
February 13, 2009 at 1:00 pm
What every one else said, and also ...
Why are you even trying to use a SUM ... when you're only looking at one row?
July 24, 2010 at 9:42 am
Hi,
instead using all the columns in the group by clause, you can use aggregate function "OVER BY " in the query............
OR
give me the details of the output what u want.....
July 25, 2010 at 12:14 am
In group by clause, you should include all the columns present in the select list that are not aggregated.
So, in this example include all the columns in the group by clause except Sum(Value).
August 4, 2010 at 2:36 am
There is no sense the query you asked for, but it is possible to retrieve the info you need, just
build your query like the below one:
SELECT OrderFormNo
,ClientName
,OrderDate
,Product
,sum(Value)as Total
,InvoiceQuantity
,PendingQuantity
FROM AOM_Tbl_PendingOrders
GROUP BY OrderFormNo, ClientName,OrderDate, InvoiceQuantity, PendingQuantity, product
But remember there is no sense you get all the fields to sum. You must build a result set with some sense for example:
SELECT ClientName, OrderDate, Sum(value) as Total
FROM AOM_Tbl_PendingOrders
Group By ClientName, OrderDate
The above query is gathering All Orders made in a time stamp from customers and applying a sum on value field.
It has sense because you can count and know how much you have gain in that time for each Customer.
I know it is an old post, but I resolved to explain a little bit more why it had no sense like some folks were talking!
Regards
Best Regards,
Marcos Rosa / marcosfac@gmail.com
Viewing 6 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply