Aggregate functions like 'max' in XQuery..

Hello,
I am trying to find the max of one of the fields in the table using XQuery aggregate function: fn:max as described in the below URL:
http://e-docs.bea.com/aldsp/docs30/xquery/sql_pushdown.html
Here is what I have:
declare $lineNo as xs:int :=
     for $pd in ns4:getAllPalletDtls()
     group $pd/LINE_NO as $line_group
     by 1
     return fn:max($line_group);
However, it's giving me error at line # 3 above:
Invalid expression: Expecting AS, found '/'
I am getting this error in ALDSP3.0.1 Aqualogic Data Service Studio.
Could someone please let me know what is wrong with the above code.
Thanks a lot,
Mamta

"group" expects to be followed by a variable (not an expression). If you add a 'let' with your expression you can create the following which is more inline with your original query
declare $lineNo as xs:int :=
for $pd in ns4:getAllPalletDtls()
let $lineNo := $pd/LINE_NO
group $lineNo as $line_group
by 1
return fn:max($line_group);

Similar Messages

  • Trying to create a Histogram type/object for aggregate functions

    Hi,
    I am trying to create an aggregate function that will return a histogram
    type.
    It doesn't have to be an object that is returned, I don't mind returning
    a string but I would like to keep the associative array (or something
    else indexed by varchar2) as a static variable between iterations.
    I started out with the SecondMax example in
    http://www.csis.gvsu.edu/GeneralInfo/Oracle/appdev.920/a96595/dci11agg.htm#1004821
    But even seems that even a simpler aggregate function like one strCat
    below (which works) has problems because I get multiple permutations for
    every combination. The natural way to solve this would be to create an
    associative array as a static variable as part of the Histogram (see
    code below). However, apparently Oracle refuses to accept associate
    arrays in this context (PLS-00355 use of pl/sql table not allowed in
    this context).
    If there is no easy way to do the histogram quickly can we at least get
    something like strCat to work in a specific order with a "partition by
    ... order by clause"? It seems that even with "PARALLEL_ENABLE"
    commented out strCat still calls merge for function calls like:
    select hr,qtr, count(tzrwy) rwys,
    noam.strCat(cnt) rwycnt,
    noam.strCat(tzrwy) config,
    sum(cnt) cnt, min(minscore) minscore, max(maxscore) maxscore from
    ordrwys group by hr,qtr
    Not only does this create duplicate entries in the query result like
    "A,B,C" and "A,C,B" it seems that the order in rwycnt and config are not
    always the same so a user can not match the results based on their
    order.
    The difference between my functions and functions like sum and the
    secondMax demonstrated in the documentation is that secondMax does not
    care about the order in which it gets its arguments and does not need to
    maintain an ordered set in order to return the correct results. A good
    example of a built in oracle function that does care about all its
    arguments and probably has to maintain a similar data structure to the
    one I want is the PERCTILE_DISC function. If you can find the code for
    that function (or something like it) and forward a reference to me that
    in itself would be very helpful.
    Thanks,
    K.Dingle
    CREATE OR REPLACE type Histogram as object
    -- TYPE Hist10 IS TABLE OF pls_integer INDEX BY varchar2(10),
    -- retval hist10;
    -- retval number,
    retval noam.const.hist10,
    static function ODCIAggregateInitialize (sctx IN OUT Histogram)
    return number,
    member function ODCIAggregateIterate (self IN OUT Histogram,
    value IN varchar2) return number,
    member function ODCIAggregateTerminate (self IN Histogram,
    returnValue OUT varchar2,
    flags IN number) return number,
    member function ODCIAggregateMerge (self IN OUT Histogram,
    ctx2 IN Histogram) return number
    CREATE OR REPLACE type body Histogram is
    static function ODCIAggregateInitialize(sctx IN OUT Histogram) return
    number is
    begin
    sctx := const.Hist10();
    return ODCIConst.Success;
    end;
    member function ODCIAggregateIterate(self IN OUT Histogram, value IN
    varchar2)
    return number is
    begin
    if self.retval.exist(value)
    then self.retval(value):=self.retval(value)+1;
    else self.retval(value):=1;
    end if;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateTerminate(self IN Histogram,
    returnValue OUT varchar2,
    flags IN number)
    return number is
    begin
    returnValue := self.retval;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateMerge(self IN OUT Histogram,
    ctx2 IN Histogram) return number is
    begin
    i := ctx2.FIRST; -- get subscript of first element
    WHILE i IS NOT NULL LOOP
    if self.retval.exist(ctx2(i))
    then self.retval(i):=self.retval(i)+ctx2.retval(i);
    else self.retval(value):=ctx2.retval(i);
    end if;
    i := ctx2.NEXT(i); -- get subscript of next element
    END LOOP;
    return ODCIConst.Success;
    end;
    end;
    CREATE OR REPLACE type stringCat as object
    retval varchar2(16383), -- concat of all value to now varchar2, --
    highest value seen so far
    static function ODCIAggregateInitialize (sctx IN OUT stringCat)
    return number,
    member function ODCIAggregateIterate (self IN OUT stringCat,
    value IN varchar2) return number,
    member function ODCIAggregateTerminate (self IN stringCat,
    returnValue OUT varchar2,
    flags IN number) return number,
    member function ODCIAggregateMerge (self IN OUT stringCat,
    ctx2 IN stringCat) return number
    CREATE OR REPLACE type body stringCat is
    static function ODCIAggregateInitialize(sctx IN OUT stringCat) return
    number is
    begin
    sctx := stringCat('');
    return ODCIConst.Success;
    end;
    member function ODCIAggregateIterate(self IN OUT stringCat, value IN
    varchar2)
    return number is
    begin
    if self.retval is null
    then self.retval:=value;
    else self.retval:=self.retval || ',' || value;
    end if;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateTerminate(self IN stringCat,
    returnValue OUT varchar2,
    flags IN number)
    return number is
    begin
    returnValue := self.retval;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateMerge(self IN OUT stringCat,
    ctx2 IN stringCat) return number is
    begin
    self.retval := self.retval || ctx2.retval;
    return ODCIConst.Success;
    end;
    end;
    CREATE OR REPLACE FUNCTION StrCat (input varchar2) RETURN varchar2
    -- PARALLEL_ENABLE
    AGGREGATE USING StringCat;

    GraphicsConfiguration is an abstract class. You would need to subclass it. From the line of code you posted, it seems like you are going about things the wrong way. What are you trying to accomplish? Shouldn't this question be posted in the Swing or AWT forum?

  • Aggregate functions in EJBQL ???

    Does the latest version of Oracle App server support aggregate functions like SUM/COUNT/AVG in the EJBQL?

    Does the latest version of Oracle App server support aggregate functions like SUM/COUNT/AVG in the EJBQL? Hi Swami --
    The latest version of Oracle9iAS - v903 is J2EE 1.3 compatible so it supports all of the EJB 2.0 specification.
    The EJB 2.0 specification lists the following functions for EJBQL:
    String Functions:
    CONCAT(String, String) returns a String
    SUBSTRING(String, start, length) returns a String
    LOCATE(String, String [, start]) returns an int
    LENGTH(String) returns an int
    Arithmetic Functions:
    ABS(number) returns a number (int, float, or double)
    SQRT(double) returns a double
    The latest version of the EJB 2.1 specification which will be part of J2EE 1.4, has added support for aggregate functions like orderby, sum, count, etc.
    11.2.7.2 Aggregate Functions in the SELECT Clause
    The result of an EJB QL query may be the result of an aggregate function applied to a path expression.
    The following aggregate functions can be used in the SELECT clause of an EJB QL query: AVG,
    COUNT, MAX, MIN, SUM.
    We will support these when the EJB 2.1 specification is finalized and we produce our J2EE 1.4 compatible implementation.
    cheers
    -steve-

  • Aggregate function on "large value type"

    We are constrained to use a model that stores records in a main table and various attributes of the record in a second table. Something like this: main record table CAR, attribute table CAR_DETAILS with CAR_DETAILS have key value pairs like "color"
    "blue" and "doors" "4".
    For reports we need to flatten the one to many nature of this to get CAR and color and doors by using an aggregate function like: 
    car_id, max(car_detail.value) filtered on car_detail.key = "color", max(car_detail.value) filtered on car_detail.key = "doors". 
    This works on other tables but the car_detail table (shall we say) appears to store its values as blobs. In any case when we attempt to aggregate we get "The query uses an aggregate function on a large value type expression. Large value type expressions
    can not be aggregated."
    Since we can't change the model, we would need to use another function to change this to a smaller string (or date, these are actually mostly date), but none of the very limited set of functions available seems to work to make this aggregation possible (and
    there is no "first" or anything else similar). 
    The list of functions available in Report Model Queries can be found at https://msdn.microsoft.com/en-us/library/ee210538.aspx
    Appreciate any ideas on how to solve this
     

    I found a work around : create a second dataset reversing the direction:
    car_detail.key, car_detail.value, car_id
    with this filtered by car_detail.key = "color" (or doors etc)
    Then use a lookup from the first dataset to the second to display the data:
    =Lookup(Fields!car_Id.Value,Fields!Icar_Id.Value,Fields!car_detail.Value, "DataSet2")
    where the 1st field is in the main report dataset, the second and third are in the lookup dataset, and the 4th parameter is the name of the lookup dataset. 
    Would still really like to have a solution that allows aggregation for ease of use and efficiency. 

  • Running Aggregate Functions, Attribute or Measure?

    Hi Guys:
    I wonder if this is a bug in BIEE 11g? I am using 11.1.1.6.
    My requirement is quite simple, I have a measure, and I want to show this measure as a cumulative curve by month. For example, let's suppose there are three columns in Criteria:
    Month, Amount, RSUM(Amount)
    Then I plot a curve by RSUM(Amount) vs. Month. In BIEE 10, there is no problems. However in 11.1.1.6, I got an error. I look into the table and found that, after using running aggregate functions, like RSUM or MSUM, the column becames Attribute, instead of Measure. In other word, although I can see the RSUM(Amount) column in Criteria page shows a yellow icon, it turns into blue in Results page! Since it becames Attributes in Results page, I cannot drag RSUM(Amount) into Measures area in Line Graph. I can see the correct values in Table view, but got error in Line Graph view.
    Why the column properties are different between Criteria and Results? And are there any workaround to plot a cumulative curve? I dont want Parete graph.
    Thanks
    Larry

    Hi Larry,
    I do not think this is any bug in .6 and I just gave a try successfully to confirm that too. My test case follows
    1. Created an analysis with Period.Month and Measures.Value
    2. Added another measure and changed the formula of Measures.Value as RSUM(Measures.Value) and still see it to be a measure as expected.
    3. Navigated to results section and added all kind of graphs to notice that it is behaving as expected.
    Can you let us know, what error are you hitting at in the graph?
    Thank you,
    Dhar

  • Need help on real life usage of Aggregate functions

    Hi All,
    I'm preparing for 9i certification 1st paper and I'm now looking at aggregate functions. Could you somebody guide me to any link or source of information about the various various aggregate functions like CORR, COVAR_POP, COVAR_SAMP, DENSE_RANK etc. knowing the real life implementation would help me better understand those functions.
    Thanks in advance.

    Hi Charles,
    I'm having the same issue. If anyone answers my post, I'll let you know. If you remember, please let me know if anyone gives you an answer. I'm gonna try calling Apple tomorrow.
    All the best,
    Jimmy

  • Aggregate function max

    hi evrybdy
    can we use MAX aggregate  function to pick a field of type char from database table ...if yes thn how ..?
    plzzz ans soon .
    thank u .

    No. Max is only for numbers. ( even it will not work for NUMC type )
    OPENSQL statements will not work as ASCII format.
    Cheers
    Kothand

  • Does EJBQL in JDeveloper support max aggregate function ?

    Does EJBQL in JDeveloper support max aggregate function ?
    I can't get it to work using select max(o.time) from MyObject o; It always returns the MyObject to me.
    Anybody knows how to do this ?
    Thanks.

    No one knows how exactly this works in JDeveloper 11g? As I see it, it's most likely a bug. For one, JDeveloper already supports plenty of databases and enforces some limitations on the useability of these databases where necessary (for instance, JDBC Positioning instead of Oracle's way of binding for the bind variables in a query). However, this enforcement does not happen with the WHERE clause of the view criteria in MySQL when you choose an operator that concatenates strings together in the WHERE clause, such as "contains". You'd expect it's smart enough to use different syntax for concatenating the strings, depending on the database (e.g., CONCAT for MySQL, || for Oracle). Second, lack of this enforcement should not break functionality, and here it does (searching with wildcards in LOV is just not possible declaratively with MySQL), which resembles a bug in the software.
    For now, I've completely rewritten the LOV in Java, so it's not declarative anymore, but programmatic. It works, resembles searching with "contains" and it stays that way, despite of the higher difficulty in maintenance, until this issue can be solved declaratively, by any means: via a patch release or via a workaround. I hope someone can provide me (and quite possibly others facing this issue) with insight upon this.
    Thanks in advance.

  • Why doesn't PIVOT clause work with COLLECT aggregate function in 11g ?

    Hello all !
    I am really puzzled as to what is considered an aggregate function in the context of the PIVOT clause in 11g.
    I have been toying with quite a few things related to collections lately and this arose as an aside :
    CREATE TABLE TEST_COLL
       NODE_ID    VARCHAR2(15 CHAR) NOT NULL,
       NODE_VALUE VARCHAR2(45 CHAR) NOT NULL,
       NODE_LEVEL NUMBER(1)         NOT NULL
    CREATE OR REPLACE TYPE TREE_NODE AS OBJECT
       NODE_KEY  VARCHAR2( 15 CHAR),
       NODE_NAME VARCHAR2(127 CHAR)
    CREATE OR REPLACE TYPE TREE_NODES AS TABLE OF TREE_NODE NOT NULL;At this stage I am sure we all agree that the query
    SELECT NODE_LEVEL,
           CAST(COLLECT(TREE_NODE(NODE_ID, NODE_VALUE)) AS TREE_NODES) AS NODES
      FROM TEST_COLL
    GROUP BY NODE_LEVEL;is perfectly valid as the COLLECT function is an aggregate function according to the [Official Documentation|http://docs.oracle.com/cd/E11882_01/server.112/e10592/functions031.htm#i1271564]
    But then, one of the following two queries should work
    SELECT CAST(REGION_NODES     AS TREE_NODES) AS REGIONS,
           CAST(DEPARTMENT_NODES AS TREE_NODES) AS DEPARTMENTS,
           CAST(AREA_NODES       AS TREE_NODES) AS AREAS,
           CAST(CENTRE_NODES     AS TREE_NODES) AS CENTRES
      FROM (SELECT NODE_LEVEL, TREE_NODE(NODE_ID, NODE_VALUE) AS NODE
              FROM TREE_COLL
    PIVOT (COLLECT(NODE) FOR NODE_LEVEL IN (1 AS REGION_NODES,
                                             2 AS DEPARTMENT_NODES,
                                             3 AS AREA_NODES,
                                             4 AS CENTRE_NODES
    or (better)
    SELECT REGION_NODES     AS REGIONS,
           DEPARTMENT_NODES AS DEPARTMENTS,
           AREA_NODES       AS AREAS,
           CENTRE_NODES     AS CENTRES
      FROM (SELECT NODE_LEVEL, TREE_NODE(NODE_ID, NODE_VALUE) AS NODE
              FROM TREE_COLL
    PIVOT (CAST(COLLECT(NODE) AS TREE_NODES) FOR NODE_LEVEL IN (1 AS REGION_NODES,
                                                                 2 AS DEPARTMENT_NODES,
                                                                 3 AS AREA_NODES,
                                                                 4 AS CENTRE_NODES
           );yet, both fail with
    ORA-56902: expect aggregate function inside pivot operationInvestigating further, I found the same behaviour when using XMLAGG as the aggregate function in the PIVOT clause.
    Is this normal ? And if it is, is there any other way to achieve the result I was anticipating ?
    My version is
    SQL> SELECT BANNER FROM V$VERSION;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - ProductionThanks in advance
    Best Regards
    Philip

    Most likely a bug. But you can bypass it by using any other aggregate making sure group consists of a single row and apply collect to a pivoted value. Yes, the cost is double aggregation. And also there is another cost - you would need to create MAP member function otherwise aggreations like MAX/MIN, etc. will not work:
    CREATE OR REPLACE TYPE TREE_NODE AS OBJECT
       NODE_KEY  VARCHAR2( 15 CHAR),
       NODE_NAME VARCHAR2(127 CHAR),
       map member function f return varchar2
    Type created.
    CREATE OR REPLACE TYPE BODY TREE_NODE AS
      map member function f return varchar2 is
      begin
         return NODE_NAME;
      end f;
    end;
    Type body created.
    CREATE OR REPLACE TYPE TREE_NODES AS TABLE OF TREE_NODE NOT NULL
    Type created.
    SQL> select  *
      2    from  test_coll
      3  /
    NODE_ID NODE_VALUE NODE_LEVEL
    1       A                   1
    2       B                   2
    3       C                   3
    4       D                   4
    5       E                   1
    6       F                   2
    7       G                   3
    8       H                   4
    8 rows selected.
    SQL> Now:
    SELECT CAST(COLLECT(REGION_NODES)     AS TREE_NODES) AS REGIONS,
           CAST(COLLECT(DEPARTMENT_NODES) AS TREE_NODES) AS DEPARTMENTS,
           CAST(COLLECT(AREA_NODES)       AS TREE_NODES) AS AREAS,
           CAST(COLLECT(CENTRE_NODES)     AS TREE_NODES) AS CENTRES
      FROM (
            SELECT  ROWID RID,
                    NODE_LEVEL,
                    TREE_NODE(NODE_ID, NODE_VALUE) AS NODE
              FROM  TEST_COLL
    PIVOT (MAX(NODE) FOR NODE_LEVEL IN (
                                         1 AS REGION_NODES,
                                         2 AS DEPARTMENT_NODES,
                                         3 AS AREA_NODES,
                                         4 AS CENTRE_NODES
    REGIONS(NODE_KEY, NODE_NAME)                         DEPARTMENTS(NODE_KEY, NODE_NAME)                     AREAS(NODE_KEY, NODE_NAME)                           CENTRES(NODE_KEY, NODE_NAME)
    TREE_NODES(TREE_NODE('1', 'A'), TREE_NODE('5', 'E')) TREE_NODES(TREE_NODE('6', 'F'), TREE_NODE('2', 'B')) TREE_NODES(TREE_NODE('7', 'G'), TREE_NODE('3', 'C')) TREE_NODES(TREE_NODE('8', 'H'), TREE_NODE('4', 'D'))
    SQL> SY.

  • Problem while using aggregate functions in EJB QL 2.1

    Hai all,
       I am using aggregate function as follows
       select max(c.id) from customer as c
      for this iam selected check box EJB QL 2.1 in persistent.xml
      this is validated by nwds, but while deploying server raising error like ejb ql syntax error.
      Actually according to EJB QL 2.1 this is a valid query, what i need to do for run this same query .
      Anybody please help me in this regard
    Regards
    Somaraju

    Beevin
      Both two are not even validated,
      but with the first one as select max(c.id) from customer as c , in this case it is validated but while deploying it is error as , object must be return
      But when i saw  the ejb2.1 specification we can write this type of queries also ?
      Is it problem with was any thing
    Regards
    Somaraju

  • Aggregate function for a report that has sets

    My report combines similar analysis into sets. I need to apply aggregate function such as Max() to the resulting columns. I tried but Analytics doesn't like that. Can someone tell me if this is supported or not? If not, what would be a workaround?

    Have you tried placing the results into a pivot table then assigning this to display MAX results

  • How to use aggregate function with Date

    Hi All,
    I have a group of date from that is it possible to Max and Min of date.
    I have tried like this but its errored out <?MIN (current-group()/CREATION_DATE)?>.
    I have also tried like this but it doesnt works
    <?xdoxslt:minimum(CREATION_DATE)?>
    Is it possible to use aggregate function with date values.
    Thanks & Regards
    Srikkanth

    Hi KAVI PRIYA,
    if date is not in cannonical format, how can we change it in BI publisher, then how to calcualte minimum and as well as maximum.
    please advise me,
    Thanks,
    Sri

  • Using an Aggregate Function in a Sub-SELECT

    Ok. I have this Sub-SELECT and I'd like to base my outside query based on the resyult set of my inner Sub-SELECT which contains an Aggregate function.
    Is that possible???
    Here's the Query...
    SELECT *
    FROM CUSTPRO.CPM_PND_TRAN_HDR CPMPNDTH
    INNER JOIN (SELECT CPMPNDT2.ky_pnd_seq_trans,
    CPMPNDT2.id_ba_esco,
    CPMPNDT2.ky_ba,
    CPMPNDT2.ky_enroll,
    MAX(CPMPNDT2.dt_billed_by_css)
    FROM CUSTPRO.CPM_PND_TRAN_HDR CPMPNDT2
    WHERE CPMPNDT2.ky_pnd_seq_trans IN (6544937)
    GROUP BY CPMPNDT2.ky_pnd_seq_trans,
    CPMPNDT2.id_ba_esco,
    CPMPNDT2.ky_ba,
    CPMPNDT2.ky_enroll) DERIVE1
    ON CPMPNDTH.id_ba_esco = DERIVE1.id_ba_esco
    AND CPMPNDTH.ky_ba = DERIVE1.ky_ba
    AND CPMPNDTH.ky_enroll = DERIVE1.ky_enroll
    AND CPMPNDTH.dt_billed_by_css = ????DERIVE1.MAX(CPMPNDT2.dt_billed_by_css)???
    How can I designate that last qualifier ????....
    PSULionRP

    You should give your aggregate function a column-alias as in:
    SELECT *
    FROM   custpro.cpm_pnd_tran_hdr cpmpndth
           INNER JOIN (SELECT   cpmpndt2.ky_pnd_seq_trans,
                                cpmpndt2.id_ba_esco,
                                cpmpndt2.ky_ba,
                                cpmpndt2.ky_enroll,
                                Max(cpmpndt2.dt_billed_by_css) as XXX    -- ADDED THIS.
                       FROM     custpro.cpm_pnd_tran_hdr cpmpndt2
                       WHERE    cpmpndt2.ky_pnd_seq_trans IN (6544937)
                       GROUP BY cpmpndt2.ky_pnd_seq_trans,
                                cpmpndt2.id_ba_esco,
                                cpmpndt2.ky_ba,
                                cpmpndt2.ky_enroll) derive1
             ON cpmpndth.id_ba_esco = derive1.id_ba_esco
                AND cpmpndth.ky_ba = derive1.ky_ba
                AND cpmpndth.ky_enroll = derive1.ky_enroll
                AND cpmpndth.dt_billed_by_css = derive1.XXX
    /

  • Aggregate functions and normal function in SELECT statement

    hi
    i am using MS Access DataBase ...
    i have lot of integer coloumns in my Database
    i want to retrieve the coloumn values as well as the min , max and avg of that coloumn
    i dont know whether its possible to do in a single statement or not
    generally if we retrieve the values of a particular coloum
    we say " SELECT length FROM TABLENAME WHERE somecondition"
    and then get the values as int len = rs.getInt("length")..... over a loop
    but how to retieve the value of an aggregate function?
    like if i say "SELECT avg(colname),max(colname),min(colname) FROM TABLENAME WHERE somecondition"
    how do i retrieve this value ???
    i dont know if its possible or not ....pls help.........

    Give names too each column
    SELECT avg(colname) average,max(colname) max,....
    and then rs.getInt("average")
    This works in Oracle and Sybase, not sure on MS access tough

  • Problem with aggregate function

    Hello,
    the prerequisite is to have a table with the following columns (#id, a_date).
    Now the task is to select the maximum date from a range of rows of this table
    select max(t.a_date)
    from the_table t
    where <condition to get only some rows of the_table>
    and to get the id of the record which holds the maximum date. That's where the problem is located. It should look like the following code (yes, I know this cannot work because grouping by the id makes the aggregate senseless) just to make clear what I want to do.
    select max(t.a_date), t.id
    from the_table t
    where <condition to get only some rows of the_table>
    group by t.id
    Does anybody have any idea how to solve the problem?
    With regards,
    Cosima
    Message was edited by:
    Cosima Laube

    Hi all,
    as the condition in the where-clause is very complex, I decided to use the solution with the FIRST function. After googling and reading a bit, I have just two more questions for my deeper understanding:
    1) am I right that both snippets below do exactly the same?
    SELECT MAX (t.a_date)
         , MAX (t.ID)KEEP (DENSE_RANK FIRST ORDER BY t.a_date DESC)
      FROM the_table t
    WHERE <condition to get only some rows of the_table>
    SELECT MAX (t.a_date)
         , MAX (t.ID)KEEP (DENSE_RANK LAST ORDER BY t.a_date ASC)
      FROM the_table t
    WHERE <condition to get only some rows of the_table>2) can I use als the min function for t.ID as there the aggregate function does not have any effect (but is necessary in order to use KEEP and FIRST or KEEP and LAST)?
    With regards,
    Cosima
    Message was edited by:
    Cosima Laube

Maybe you are looking for

  • Airport card no longer detected

    My Powermac G5 (dual 2.0 ghz, summer of 2005) has been running on my wireless network without a hitch until recently when it randomly stopped recognizing my Airport Extreme card after I restarted it following a software update. The card's installed c

  • SU24 in ECC 6.0

    Hello, The interface for SU24 in ECC 6.0 is completely different from the previous version. I was unable to find Check/Maintained anywhere. There is a new Field called 'Proposal'. I am confused. Could someone please please explain how SU24 in ECC 6.0

  • How to develop a rich text editor using Web-Dynpro?

    Hello Everyone, I am new hire, today I got a task from leader to develop a rich text editor using Web-Dynpro, Because I just finished the BC400 and NET310 training and lack of expericen in ABAP, Can anyone tell me the main idea to accomplish the task

  • Syncing to Macbook Air

    Hi, I have an iPhone and and iPad on the same Apple ID and they are fully synced with my iTunes purchases (tv, movies, etc).  They were also linked to my old PC but only some of my purchases appear in my PC library. I have recently purchased a Macboo

  • Cannot activate DBs on server that was updated with CU

    I have an Exchange 2013 DAG with two nodes. Everything is currently running CU5.  Today I updated one of the nodes to CU6.  The install seemed to run very slow but completed.  It actually took a few hours to complete the CU6 update.  Everything seeme