2007 Jul 16 12:50 PM
Hi,
As per <b>performance wise</b> to use aggreate functions (SUM,AVG) on select using Group by is best or simply writing query and then having control break events on it.
which one is gud??
PRa
2007 Jul 16 12:55 PM
hi,
GROUP BY...
GROUP BY... was added to SQL because aggregate functions (like SUM) return the aggregate of all column values every time they are called, and without the GROUP BY function it was impossible to find the sum for each individual group of column values.
The syntax for the GROUP BY function is:
SELECT column,SUM(column) FROM table GROUP BY column
SO USING GROUP BY aggregate function is better which improves performance by reducing time consuming in retrieving the data.
**********please reward points if the information is helpful to you*************
Hi,
As per <b>performance wise</b> to use aggreate functions (SUM,AVG) on select using Group by is best or simply writing query and then having control break events on it.
which one is gud??
PRa
2007 Jul 16 12:54 PM
Hi,
If you want to find the maximum, minimum, sum and average value
or the count of a database column, use a select list with aggregate
functions instead of computing the aggregates yourself.
Network load is considerably less.
Its better to use AVG etc on NON-BUFFERED tables.
When you use AVG etc then select query ignores the buffer.
Regards,
Sesh
2007 Jul 16 12:54 PM
Hi,
Use of Aggrigate function is useful!
Mostly program takes time in fetching data than processing , ofcourse it depends!
But i would say both you can apply at a time.
Reward if useful!
2007 Jul 16 12:54 PM
Using Aggregate functions is better
For performance issues see se30
Reward points !!!!
2007 Jul 16 12:55 PM
Hi ...
If you want to display only the Summarized data records from Database then it is good to use Group by with Aggregate operations. Since they can reduce the volume of data transferred from DB server to App Server.
But if we have to display the Detailed records along with the Summary then we have to use Control processing statements such as AT NEW .. AT END Of
<b>Reward if helpful.</b>
2007 Jul 16 12:58 PM
My requirement is quite similar...i want to display some thing like
select f1,f2,f3,f4, sum(f5)....group by f1,f2,f3,f4..
which one is best and how can i get group by f1 and f2 and f3 and f4 at control break statements...
PRa
2007 Jul 16 1:03 PM
Hi praneet,
1. select f1,f2,f3,f4, sum(f5)....group by f1,f2,f3,f4..
Using the sql would be simple and effective.
No additional logic is required.
The required data, we directly get in the query itself.
regards,
amit m.
2007 Jul 16 1:07 PM
Amit,
I am asking how to implement group by clause logic using at ...end at statments..
PRa
2007 Jul 16 12:55 PM
hi,
GROUP BY...
GROUP BY... was added to SQL because aggregate functions (like SUM) return the aggregate of all column values every time they are called, and without the GROUP BY function it was impossible to find the sum for each individual group of column values.
The syntax for the GROUP BY function is:
SELECT column,SUM(column) FROM table GROUP BY column
SO USING GROUP BY aggregate function is better which improves performance by reducing time consuming in retrieving the data.
**********please reward points if the information is helpful to you*************
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |