<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Aggregate Function in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772821#M907822</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kalyan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Aggregate Functions&lt;/P&gt;&lt;P&gt;SQL Aggregate functions perform calculations in an SQL query.  Aggregates are most often used in combination with a Group By clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below are the SQL aggregate functions available in an MS Access query:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aggregate&lt;/P&gt;&lt;P&gt;Function Description &lt;/P&gt;&lt;P&gt;Select Sum Total (count) of the field values &lt;/P&gt;&lt;P&gt;Select Avg Average of the field values &lt;/P&gt;&lt;P&gt;Select Min Lowest (minimum) field value &lt;/P&gt;&lt;P&gt;Select Max Highest (maximum) field value &lt;/P&gt;&lt;P&gt;Select Count Count of the values other than nulls &lt;/P&gt;&lt;P&gt;Select StDev Standard deviation of the field values including date/time fields &lt;/P&gt;&lt;P&gt;Select Var Variance of the field values including date/time &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some examples of aggregate function usage:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Count Aggregate Function Query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Count(Emp_ID) From M_Employees;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The query above simply counts the autonumber field in the M_Employees table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Average Aggregate Function Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Avg(Emp_Salary) From M_Employees Where Emp_Age&amp;lt;50;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above aggregate query determines the average salary for employees under 50 years of age.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SQL aggregate query below gets a little interesting by showing you how to answer more complex question of your data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M_Employees ID Emp_Name Emp_Salary Emp_Age &lt;/P&gt;&lt;P&gt;1 Joe $18.00 51 &lt;/P&gt;&lt;P&gt;2 billy $17.00 52 &lt;/P&gt;&lt;P&gt;3 Molly $16.00 53 &lt;/P&gt;&lt;P&gt;4 bobby $15.00 41 &lt;/P&gt;&lt;P&gt;5 robert $14.00 42 &lt;/P&gt;&lt;P&gt;6 milly $13.00 43 &lt;/P&gt;&lt;P&gt;7 harry $12.00 44 &lt;/P&gt;&lt;P&gt;8 ed $11.00 45 &lt;/P&gt;&lt;P&gt;9 sally $10.00 46 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT avg(iif(emp_age&amp;gt;=50,Emp_Salary,null)) as Over_50_Salary,avg(iif(emp_age&amp;lt;50,emp_salary,null)) as Under_50_Salary&lt;/P&gt;&lt;P&gt;FROM M_Employees;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Over_50_Salary Under_50_Salary &lt;/P&gt;&lt;P&gt;$17.00 $12.50 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note the use of the immediate if (iif) to bracket the results and return two columns where the would normally be only one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note there is no Group By which is normally associated with an SQL aggregate function query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note we are using aliases (as) to generate our own column names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note nulls are skipped in the average aggregate and that is what makes this query work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select StDev Query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the Employee table shown above now we get the standard deviation of the salary column:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT StDev([Emp_Salary]) AS Salary_Standard_Deviation FROM M_Employees;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Results are pretty simple:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Select Var Aggregate Variance Query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT Var([Emp_Salary]) AS Salary_Variance FROM M_Employees;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The results are shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some additional techniques to consider...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When creating a report it is often useful to have the Count Average and Standard Deviation listed at the bottom of each column of numbers.  As fairly simple technique is to use a series of union queries to build the result rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first query would retrieve all the raw numbers in a multi row list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second union query would append the aggregate count function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The third union query would add the aggregate average function.  Finally the last union select would add the standard deviation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another technique to try out is to use the aggregate functions in the scalar query. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More Aggregate Function Information:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Domain Aggregate Functions in MS Access&lt;/P&gt;&lt;P&gt;SQL Aggregate Function Examples: Dlookup, Dmin, Dmax, Dlast, Dfirst, DAvg, DSum, Dcount, DStdev, DstdevP,Dvar, DvarP.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.blueclaw-db.com/domain_aggregate_function/" target="test_blank"&gt;www.blueclaw-db.com/domain_aggregate_function/&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Advanced Union Query Download&lt;/P&gt;&lt;P&gt;In this example we selecting the individual data records from the table and at the same time using the union query function to select SQL Aggregate functions ...&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.blueclaw-db.com/download/union_query_advanced.htm" target="test_blank"&gt;www.blueclaw-db.com/download/union_query_advanced.htm&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for abap aggregate function see these links&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3990358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3990358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3990358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3990358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sagar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls reward me if usefull&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 May 2008 13:04:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-02T13:04:22Z</dc:date>
    <item>
      <title>Aggregate Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772818#M907819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Can AnyOne Give Example for Agrregate Function... &lt;/P&gt;&lt;P&gt;   Using Max , Min , and Sum , Count .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Some Coded Programs... Will be better&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 May 2008 12:47:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772818#M907819</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-02T12:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772819#M907820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MAX Returns the greatest value in the column determined by the database field f for the selected lines. Specifying DISTINCT does not change the result. NULL values are ignored unless all values in a column are NULL values. In this case, the result is NULL . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MIN Returns the smallest value in the column determined by the database field f for the selected lines. Specifying DISTINCT does not change the result. NULL values are ignored unless all values in a column are NULL values. In this case, the result is NULL . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AVG Returns the average value in the column determined by the database field f for the selected lines. AVG can only apply to a numeric field. NULL values are ignored unless all values in a column are NULL values. In this case, the result is NULL . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM Returns the sum of all values in the column determined by the database field f for the selected lines. SUM can only apply to a numeric field. NULL values are ignored unless all values in a column are NULL values. In this case, the result is NULL . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COUNT Returns the number of different values in the column determined by the database field f for the selected lines. Specifying DISTINCT is obligatory here. NULL values are ignored unless all values in a column are NULL values. In this case, the result is 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COUNT( * ) Returns the number of selected lines. If the SELECT command contains a GROUP BY clause , it returns the number of lines for each group. The form COUNT(*) is also allowed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If ai is a field f , MAX( f ) , MIN( f ) or SUM( f ) , the corresponding column of the result set has the same ABAP/4 Dictionary format as f . With COUNT( f ) or COUNT( * ) , the column has the type INT4 , with AVG( f ) the type FLTP . &lt;/P&gt;&lt;P&gt;If you specify aggregate functions together with one or more database fields in a SELECT clause, all database fields not used in one of the aggregate functions must be listed in the GROUP-BY clause .  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output all flight destinations for Lufthansa flights from Frankfurt: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES SPFLI.
DATA   TARGET LIKE SPFLI-CITYTO.

SELECT DISTINCT CITYTO
       INTO TARGET FROM SPFLI
       WHERE
         CARRID   = 'LH '       AND
         CITYFROM = 'FRANKFURT'.
  WRITE: / TARGET.
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output the number of airline carriers which fly to New York: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES SPFLI.
DATA   COUNT TYPE I.

SELECT COUNT( DISTINCT CARRID )
       INTO COUNT FROM SPFLI
       WHERE
         CITYTO = 'NEW YORK'.
WRITE: / COUNT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output the number of passengers, the total weight and the average weight of luggage for all Lufthansa flights on 28.02.1995: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES SBOOK.
DATA:  COUNT TYPE I, SUM TYPE P DECIMALS 2, AVG TYPE F.
DATA:  CONNID LIKE SBOOK-CONNID.

SELECT CONNID COUNT( * ) SUM( LUGGWEIGHT ) AVG( LUGGWEIGHT )
       INTO (CONNID, COUNT, SUM, AVG)
       FROM SBOOK
       WHERE
         CARRID   = 'LH '      AND
         FLDATE   = '19950228'
       GROUP BY CONNID.
  WRITE: / CONNID, COUNT, SUM, AVG.
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Vibha &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 May 2008 12:54:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772819#M907820</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-02T12:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772820#M907821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SELECT MAX( fieldx ) FROM database table INTO lv_max WHERE = condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Same for Min, SUM and COUNT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 May 2008 12:55:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772820#M907821</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-05-02T12:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772821#M907822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kalyan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Aggregate Functions&lt;/P&gt;&lt;P&gt;SQL Aggregate functions perform calculations in an SQL query.  Aggregates are most often used in combination with a Group By clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below are the SQL aggregate functions available in an MS Access query:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aggregate&lt;/P&gt;&lt;P&gt;Function Description &lt;/P&gt;&lt;P&gt;Select Sum Total (count) of the field values &lt;/P&gt;&lt;P&gt;Select Avg Average of the field values &lt;/P&gt;&lt;P&gt;Select Min Lowest (minimum) field value &lt;/P&gt;&lt;P&gt;Select Max Highest (maximum) field value &lt;/P&gt;&lt;P&gt;Select Count Count of the values other than nulls &lt;/P&gt;&lt;P&gt;Select StDev Standard deviation of the field values including date/time fields &lt;/P&gt;&lt;P&gt;Select Var Variance of the field values including date/time &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some examples of aggregate function usage:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Count Aggregate Function Query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Count(Emp_ID) From M_Employees;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The query above simply counts the autonumber field in the M_Employees table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Average Aggregate Function Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Avg(Emp_Salary) From M_Employees Where Emp_Age&amp;lt;50;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above aggregate query determines the average salary for employees under 50 years of age.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SQL aggregate query below gets a little interesting by showing you how to answer more complex question of your data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M_Employees ID Emp_Name Emp_Salary Emp_Age &lt;/P&gt;&lt;P&gt;1 Joe $18.00 51 &lt;/P&gt;&lt;P&gt;2 billy $17.00 52 &lt;/P&gt;&lt;P&gt;3 Molly $16.00 53 &lt;/P&gt;&lt;P&gt;4 bobby $15.00 41 &lt;/P&gt;&lt;P&gt;5 robert $14.00 42 &lt;/P&gt;&lt;P&gt;6 milly $13.00 43 &lt;/P&gt;&lt;P&gt;7 harry $12.00 44 &lt;/P&gt;&lt;P&gt;8 ed $11.00 45 &lt;/P&gt;&lt;P&gt;9 sally $10.00 46 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT avg(iif(emp_age&amp;gt;=50,Emp_Salary,null)) as Over_50_Salary,avg(iif(emp_age&amp;lt;50,emp_salary,null)) as Under_50_Salary&lt;/P&gt;&lt;P&gt;FROM M_Employees;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Over_50_Salary Under_50_Salary &lt;/P&gt;&lt;P&gt;$17.00 $12.50 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note the use of the immediate if (iif) to bracket the results and return two columns where the would normally be only one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note there is no Group By which is normally associated with an SQL aggregate function query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note we are using aliases (as) to generate our own column names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note nulls are skipped in the average aggregate and that is what makes this query work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select StDev Query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the Employee table shown above now we get the standard deviation of the salary column:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT StDev([Emp_Salary]) AS Salary_Standard_Deviation FROM M_Employees;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Results are pretty simple:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Select Var Aggregate Variance Query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT Var([Emp_Salary]) AS Salary_Variance FROM M_Employees;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The results are shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some additional techniques to consider...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When creating a report it is often useful to have the Count Average and Standard Deviation listed at the bottom of each column of numbers.  As fairly simple technique is to use a series of union queries to build the result rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first query would retrieve all the raw numbers in a multi row list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second union query would append the aggregate count function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The third union query would add the aggregate average function.  Finally the last union select would add the standard deviation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another technique to try out is to use the aggregate functions in the scalar query. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More Aggregate Function Information:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Domain Aggregate Functions in MS Access&lt;/P&gt;&lt;P&gt;SQL Aggregate Function Examples: Dlookup, Dmin, Dmax, Dlast, Dfirst, DAvg, DSum, Dcount, DStdev, DstdevP,Dvar, DvarP.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.blueclaw-db.com/domain_aggregate_function/" target="test_blank"&gt;www.blueclaw-db.com/domain_aggregate_function/&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Advanced Union Query Download&lt;/P&gt;&lt;P&gt;In this example we selecting the individual data records from the table and at the same time using the union query function to select SQL Aggregate functions ...&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.blueclaw-db.com/download/union_query_advanced.htm" target="test_blank"&gt;www.blueclaw-db.com/download/union_query_advanced.htm&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for abap aggregate function see these links&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3990358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3990358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3990358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3990358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sagar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls reward me if usefull&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 May 2008 13:04:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772821#M907822</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-02T13:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772822#M907823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Max :&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3972935"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Min:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2749733"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Sum:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3624772"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Count:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3501538"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;****Reward for all useful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 May 2008 13:05:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/aggregate-function/m-p/3772822#M907823</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-02T13:05:41Z</dc:date>
    </item>
  </channel>
</rss>

