Max, Min, and Count with Group By

Hello

I want the max, min and the meter of a table that is grouped by a column

I need a combination of these two selects:

select
     max(COUNTRY_S) MAXVALUE,
     min(COUNTRY_S) MINVALUE
from
     tab_Country

select
     count(*)
from
     (select COUNTRY_TXT from tab_Country group by COUNTRY_TXT) ;

The result should be a line with the maximum and minimum of the table value and the County grouped by table, not the max and min of each group! -J' hope you understand my question?

Is this possible in a SQL-select?

Thank you very much

Best regards

Heidi

Hi, Heidi,.

HeidiWeber wrote:

Hello

I want the max, min and the meter of a table that is grouped by a column

I need a combination of these two selects:

  1. Select
  2. MAXVALUE, Max (COUNTRY_S),
  3. min (COUNTRY_S) MINVALUE
  4. Of
  5. tab_Country
  1. Select
  2. Count (*)
  3. Of
  4. (select the COUNTRY_TXT of the COUNTRY_TXT tab_Country group);

The result should be a line with the maximum and minimum of the table value and the County grouped by table, not the max and min of each group! -J' hope you understand my question?

Is this possible in a SQL-select?

Thank you very much

Best regards

Heidi

It is not clear what you want.  Maybe

SELECT MAX (country_s) AS max_country_s

MIN (country_s) AS min_country_s

COUNT (DISTINCT country_txt) AS count_country_txt

OF tab_country

;

I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: https://forums.oracle.com/message/9362002

Tags: Database

Similar Questions

  • Using the function count with grouped records

    Hi all

    This seems like it should be very easy, but I still have to find a simple way to do it.

    Suppose I want to count the possibilities which are grouped by Sales Rep at run time I filter this list with a parameter for sales stage and created date.
    I've simplified this greatly, but here's what my setup looks like now:

    Sales representative*-Count* _
    <? for-each-group: opportunity [SalesStage = param1 and creation > param2]; /SalesRep? >
    <? SalesRep? >-<? count (current - group (available))? >
    <? end for each group -? >
    _ Total

    The only solution I have to get my grand total so far is to create a variable and permanently keep a total that I will then display in the Total column. It all works, it seems that there should be an easier way, want to do a simple count (Id) for a total general. But given that the Total amount will appear after the end of each group-, I lose the filter that has been applied to the group so that the count is not valid.

    Ideas of the experts?
    Thank you!

    To get the total general
    use

    param2]/Id)?>
    

    Since you have not mentioned the complete xml code, I assumed, as the root.
    If this isn't the case, put the full path from the root.

    If you give some xml examples and explain the output you want, we can fix it immediately.

    go through these too... something can be drawn from here.
    http://winrichman.blogspot.com/search/label/summation%20In%20BIP
    http://winrichman.blogspot.com/search/label/BIP%20Vertical%20sum

  • Count (*) with Group of and a join

    I have the tables below:

    Tables:
    EMPLOYEE 
    EMP_ID         LNAME             FNAME
    1000                 SLITT              JOHN
    1001                 SLITHER              STEVE
    1002                 JACOB              MARLYN
    1003                 STUFFEY     NOSE
    1004                 SLIPPY              MOUTH
    -----
    ACCESS_TYPE
    ACCESS_TYPE_ID     ACCESS_DESCRIPTION
    1                         EMPLOYEE
    2                         EMPLOYEE_ADMIN
    3                         CONTRACTOR
    -----
    EMPLOYEE_ACCESS
    ACCESS_ID      ACCESS_TYPE_ID     EMP_ID     ACCESS_EFF_DATE     
    1               1               1000              01-JAN-13
    2               1               1001              10-FEB-13
    3               1               1002              18-FEB-13
    4               2               1003              10-OCT-12
    5               3               1004              10-MAR-08
    -----
    I'm trying to appear on the behalf of the Group of employees by their type and whose name does not begin with SL
    I wrote the following query and I get a missing Expression 00936. What I am doing wrong? Thank you

    SELECT EA. COUNT (*), ACCESS_TYPE_ID
    OF EMPLOYEE_ACCESS EA, USED E
    WHERE ACCESS_EFF_DATE > = 31 December 12 ' AND E.LNAME NOT LIKE '% SL.
    ACCESS_TYPE_ID GROUP;

    Published by: parsar on March 25, 2013 15:54

    >
    FAM COUNT (*)
    >
    You have a column named "COUNT" in your table? NOT! You probably intend to use the COUNT function: ditch the prefix aliases, functions use a prefix.
    >
    WHERE ACCESS_EFF_DATE > = 31 DECEMBER 12 '
    >
    Don't use strings to DATE values. Use the dates and the TO_DATE function if you need to convert a string to a date literal.

    This Cartesian join between the tables is unlikely to be what you want to do.

  • SQL count (*) with Group of

    Hello

    I need help to fix this SQL.

    Fields in the table are like that.
    ID(PK)
    user_id
    user_name
    login_time(timestamp)
    Basically I want the values of user_id, user_name, last time the logged-in user and total number of times the user
    select  distinct user_id , user_name, login_date from USER_LOGIN
    where login_date in (select max(login_date) from USER_LOGIN group by user_id) 
    the above query is to give the result set with user_id, user_name, last time that the user logged on, but how can I include count (*) Group of user_id in the sql above
    select  distinct user_id , user_name, login_date, count(*) from USER_LOGIN
    where login_date in (select max(login_date) from USER_LOGIN group by user_id)  group by user_id 
    the sql above does not work.

    can you help me to get the number of records by user_id group.

    Thank you
    SK

    Hello

    Looks like you want something like this:

    SELECT       user_id
    ,       user_name
    ,       MAX (login_time)     AS last_login_time
    ,       COUNT (*)          AS total_rows
    FROM       user_login
    GROUP BY  user_id
    ,            user_name
    ;
    

    This assumes that user_login is off standard (like him are often seen), such that every row of the same user_id will also have the same user_name.

    I hope that this answers your question.
    If not, post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data.

  • How to find Max, Min and Avg generation of redo to a database

    I'm trying to remake maximum, minimum and average, a database to generate daily. This information, as well as knowledge of
    specific database will be useful for me to determine the log archiving directory space allocation is sufficient for our database activity.

    I want to just make sure that the request is correct or not.

    Select upper (B.HOST_NAME) HOST_NAME, upper (B.INSTANCE_NAME) INSTANCE_NAME, A.* FROM)
    Select max (redo_in_gb) MAX_REDO_IN_GB, min (redo_in_gb) MIN_REDO_IN_GB, avg (redo_in_gb) AVG_REDO_IN_GB)
    Select sum (blocks * block_size) /(1024*1024*1024) REDO_IN_GB, trunc (first_time) as "RUN_DATE"
    v $ archived_log where trunc (first_time) > (select trunc (resetlogs_time) in v$ database_incarnation where status = 'CURRENT')
    Trunc Group (first_time))) A, V$ INSTANCE B


    Thank you
    Guz

    Yes, that sounds good.

  • bad value COUNT with GROUP OF ROLLUP

    Hi all

    I'm using GROUP BY ROLLUP for the result in the below format. However the sum obtained by the query in my totals at the end lines is not the correct value. It should be 124. I am not able to understand what could be the reason for this. Help, please.
    Query:
    SELECT decode(grouping(ACCTNUM),'1','Totals', ACCTNUM) "Client",COUNT(DISTINCT Rpt.UserId) 
    "Total Users Logged In" FROM VW_XXX_SUMMARYREPORTDATA
     Rpt WHERE Rpt.LoginDate BETWEEN TO_DATE('01-AUG-2011') and TO_DATE('31-AUG-2011')
     GROUP BY ROLLUP (Rpt.ACCTNUM) 
    HAVING (Rpt.ACCTNUM IS NULL OR Rpt.ACCTNUM = 'Totals') OR Rpt.ACCTNUM IS NOT NULL    ;
    Result:
    1XXX013000     1
    1XXX018000     1
    1XXX015800     1
    9XXX000600     1
    9XXX000700     23
    9XXX004400     1
    9XXX004900     1
    9XXX012700     1
    9XXX016400     1
    9XXX019800     1
    9XXX020000     2
    9XXX029300     5
    9XXX000100     2
    9XXX000100     1
    9XXX003200     1
    9XXX000100     1
    9XXX000200     3
    9XXX001000     11
    9XXX001900     50
    9XXX002600     1
    9XXX000800     3
    9XXX001000     1
    9XXX000100     11
    Totals          122

    Consider this:

    SQL> select
      2  e.deptno, e.job, e.ename
      3  from scott.emp e
      4  order by
      5  e.deptno, e.job, e.ename
      6  ;
    
        DEPTNO JOB       ENAME
    ---------- --------- ----------
            10 CLERK     MILLER
            10 MANAGER   CLARK
            10 PRESIDENT KING
            20 ANALYST   FORD
            20 ANALYST   SCOTT
            20 CLERK     ADAMS
            20 CLERK     SMITH
            20 MANAGER   JONES
            30 CLERK     JAMES
            30 MANAGER   BLAKE
            30 SALESMAN  ALLEN
            30 SALESMAN  MARTIN
            30 SALESMAN  TURNER
            30 SALESMAN  WARD
    
    14 rows selected.
    
    SQL> select
      2  decode(grouping(e.deptno),1,'Total',e.deptno) dept,
      3  count(distinct e.job) cnt
      4  from scott.emp e
      5  group by rollup(
      6  e.deptno
      7  )
      8  order by
      9  grouping(e.deptno),
     10  e.deptno
     11  ;
    
    DEPT                                            CNT
    ---------------------------------------- ----------
    10                                                3
    20                                                3
    30                                                3
    Total                                             5
    

    There are three different names in each of the departments. But in total, there are only 5 different.

    You can get the total that you want using analytical functions:

    SQL> select
      2  e.deptno,
      3  count(distinct e.job) cnt,
      4  sum(count(distinct e.job)) over () totalcnt
      5  from scott.emp e
      6  group by
      7  e.deptno
      8  order by
      9  e.deptno
     10  ;
    
        DEPTNO        CNT   TOTALCNT
    ---------- ---------- ----------
            10          3          9
            20          3          9
            30          3          9
    

    But this gives you the total in a column, not a line.
    If you need as a line, you might be able to do something like this:

    SQL> select
      2  decode(grouping(s.deptno),1,'Total',s.deptno) dept,
      3  sum(s.cnt) cnt
      4  from (
      5     select
      6     e.deptno,
      7     count(distinct e.job) cnt
      8     from scott.emp e
      9     group by
     10     e.deptno
     11  ) s
     12  group by rollup(
     13  s.deptno
     14  )
     15  order by
     16  grouping(s.deptno),
     17  s.deptno
     18  ;
    
    DEPT                                            CNT
    ---------------------------------------- ----------
    10                                                3
    20                                                3
    30                                                3
    Total                                             9
    

    In the Interior, you select count (distinct but without rollup. Then an external selection where you do a sum for rollup your meter internal.

    Maybe an idea for you - maybe your solution two columns would work OK ;-)

  • Equium P200-1ED: Windows randomly max & min and refusing to close

    I have an Equium P200-1ED I biought recently and Vista keep doing strange things with the windows open.

    Trying to scroll a window, click on a link or perform any action with a window, then the window can maximize randomly or minimize. Also when you try to close a window, it will be often just 'boing' home for 3 or 4 times after clicking on the 'X', and then close.

    This does not happen on my other vista machine so I guess that his problem with this one.

    Hello Andy

    Have you noticed this behavior from the first day?
    To be honest, the described issue is really amazing. Do you use the touch pad or external mouse may be? Try please test with an external mouse. I can just speculate why this happens, but according to me, there is something wrong with the touchpad settings.

    I have also for laptop Toshiba with Vista, but something like that doesn't happen to me.

  • Grouping and then find the min and max

    DROP TABLE purge of y;

    CREATE TABLE y
    (
    ID NUMBER (10),
    START_DATE_TIME NUMBER (15),
    END_DATE_TIME NUMBER (15)
    );

    INSERT INTO y VALUES (1, 20140602164819, 20140606140851);
    INSERT INTO y VALUES (1, 20140827141743, 20140827142131);
    INSERT INTO y VALUES (1, 20140827141744, 20140827141835);
    INSERT INTO y VALUES (1, 20140827141744, 20140827142131);
    INSERT INTO y VALUES (1, 20140827141944, 20140827142131);
    INSERT INTO y VALUES (1, 20140827141944, 20140924142131);
    INSERT INTO y VALUES (1, 20140927141944, 20141027142131);
    INSERT INTO y VALUES (2, 20140602164819, 20140606140851);
    INSERT INTO y VALUES (2, 20140827141743, 20140827142131);
    INSERT INTO y VALUES (2, 20140827141744, 20140827141835);
    INSERT INTO y VALUES (2, 20140827141744, 20140827142131);
    INSERT INTO y VALUES (2, 20140827141944, 20140827142131);
    INSERT INTO y VALUES (2, 20140827141944, 20140924142131);
    INSERT INTO y VALUES (2, 20140927141944, 20141027142131);

    COMMIT;

    Select
    *
    Of
    There
    order by 2, 3;

    out necessary: when the output of the table are sorted by start_date_time and end_date_time in ascending order.
    and when the value of for a particular id start_date_time is located between the
    another set of values start_date_time and end_date_time for the same id then min (start_date_time) and max (end_date_time) is the desired output.

    and if there is no overlap then (start_date_time) min and max (end_date_time) is the output desired.

    and for each line of the output in ascending order of line number order addd;

    Example output is in the output table named

    drop table output is serving;

    create an output table
    (
    ID NUMBER (10),
    START_DATE_TIME NUMBER (15),
    END_DATE_TIME NUMBER (15),
    ROW_NUMBER NUMBER (10)
    );


    Values to INSERT OUTPUT (1, 20140602164819, 20140606140851, 1);
    Values to INSERT OUTPUT (1, 20140827141743, 20140924142131, 2);
    Values to INSERT OUTPUT (1, 20140927141944, 20141027142131, 3);
    Values to INSERT OUTPUT (2, 20140602164819, 20140606140851, 1);
    Values to INSERT OUTPUT (2, 20140827141743, 20140924142131, 2);
    Values to INSERT OUTPUT (2, 20140927141944, 20141027142131, 3);

    COMMIT;

    SELECT
    *
    Of
    output
    ORDER BY 1,2,3,4;

    Thank you

    SQL_Novice

    Hello

    Your postal code.  It is difficult to tell what you're doing wrong without knowing what you are doing.

    user6166680 wrote:

    Hi Frank:

    Max works for ID 3 values only because there is only one group here, as all other values compared, they overlap with max (end_date_time);

    but when I use MAX for ID 1 and 2, the result set is not the same thing as LAG works because there is a GAP...

    Exactly, you have to find the gaps.  If start_date_time is less than or equal to the MAXIMUM of all the end_date_times earlier, then it isn't a gap; Otherwise, there is a gap.

    What is the problem with MAX?

    WITH got_new_group AS

    (

    SELECT id, start_date_time and end_date_time

    CASE

    WHEN start_date_time <= > MAX (end_date_time) OVER (PARTITION BY id )

    ORDER BY start_date_time

    end_date_time

    ROWS BETWEEN UNBOUNDED PRECEDING

    AND 1 PRECEDING

    )

    THEN 0

    1. OTHER

    END AS new_group

    OF y

    )

    got_group_number AS

    (

    SELECT id, start_date_time and end_date_time

    SUM (new_group) OVER (PARTITION BY ID.

    ORDER BY start_date_time

    end_date_time

    ) AS group_number

    OF got_new_group

    )

    SELECT id

    MIN (start_date_time) AS group_start_date_time

    MAX (end_date_time) AS group_end_date_time

    group_number

    OF got_group_number

    GROUP BY id, group_number

    ORDER BY id, group_number

    ;

    You will notice that it is exactly what I posted earlier, in response #5, except that instead of using the OFFSET it uses MAX.

    Output:

    ID GROUP_START_DATE_TIME GROUP_END_DATE_TIME GROUP_NUMBER

    --------------- --------------------- ------------------- ---------------

    1 20140602164819 20140606140851 1

    1 20140827141743 20140924142131 2

    1 20140927141944 20141027142131 3

    2 20140602164819 20140606140851 1

    2 20140827141743 20140924142131 2

    2 20140927141944 20141027142131 3

    3 20140330041350 47121231000000 1

  • every time that I connect to his screen name appears with mine and I have to choose one. How to take sound?

    My son used my pc and every time that I connect to his screen name appears with mine and I have to choose one.  How to take sound?

    Hello

    What version of Windows?
    You ask about your Windows login or a Web site?

    If you ask about Windows logon, it should work with Vista or Windows 7...

    Right click on the desktop computer > manage. In the Management Console, click on system tools > local users and groups > users, select the account else > right click > properties > OK your way out and disable the account. You will need to reactivate the account for this account to use in the future.

    Don

  • the window on my computer does not return to its original size and I can't use the max and min and exit button

    my window is too far to the right and ive tried to get to the original size and it will until a certain point to the left. This leaves me unable to use the max and min and exit tabs

    Hello

    1. What is the brand and model of the computer?

    2. is it a laptop or a desktop computer?

    3. the problem occurs after leaving the game or program?

    4 did you a recent software or changes to the material on the computer?

    Method 1:

    If this happens when you leave a game, I suggest you to follow the steps mentioned in the link and check.

    Open the troubleshooter of display quality

    http://Windows.Microsoft.com/en-us/Windows7/open-the-display-quality-Troubleshooter

    Method 2:

    I also suggest you go through the steps mentioned in the link and the Coachman.

    Change your screen resolution

    http://Windows.Microsoft.com/en-us/Windows7/change-your-screen-resolution

    Method 3:

    Step 1:

    I also suggest you to check if the problem persists in safe mode.

    Start your computer in safe mode

    http://Windows.Microsoft.com/en-us/Windows7/start-your-computer-in-safe-mode

    Step 2:

    You can also check if the problem persists in a clean boot state.

    Clean boot:

    This could happen if one of the substantive programmes is in conflict with the proper functioning of your computer. To help resolve the error and other messages, you can start Windows 7 by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or Windows 7 http://support.microsoft.com/kb/929135

    Note: when you are finished troubleshooting, follow step 7 article to start the computer to a normal startup.

    Hope this helps and keep us posted.

  • Min and Max in a row!

    Hi guys,.

    Do you know how I can get the MIN and MAX in a row?

    For example:

    C1 | C2 | C3 | C4 | C5 | C6 | C7 | C8

    10. 50. 70.  5. 90. 135. 4   | 60

    I return 4 and 135.

    I can return it without using the service?

    Thank you

    Eric

    create table t as
    with d as (
      select 1 n from dual
      union all
      select null from dual
    )
    select a.n c1, b.n*2 c2, c.n*3 c3
    from d a, d b, d c;
    
    select c1,c2,c3,
    greatest(
      coalesce(c1,c2,c3),
      coalesce(c2,c3,c1),
      coalesce(c3,c1,c2)
    ) greatest_c,
    least(
      coalesce(c1,c2,c3),
      coalesce(c2,c3,c1),
      coalesce(c3,c1,c2)
    ) least_c
    from t;
    
    C1 C2 C3 GREATEST_C LEAST_C
    1 2 3 3 1
    1 2 2 1
    1 3 3 1
    1 1 1
    2 3 3 2
    2 2 2
    3 3 3
  • Help the query to list all the days between MIN and MAX date in a table

    Hello

    Sorry, this may have already responded earlier, but I really struggled to find a previous response with the new provision of the RTO.

    In a DB 11 g, I date MIN and MAX in a table:

    {code}

    SELECT MIN (process_date) start_date, MAX (process_date) end_date FROM my_table;

    {code}

    I would get every day between these 2 dates. I mean even is there is no record in the table for a date.

    Is this possible?

    Thanks in advance,

    Olivier

    Hello

    Do you mean something like this?

    ranit@XE11GR2>> ed
    Wrote file c:\rb\1.sql
    
      1  with xx as
      2  (
      3      select
      4     to_date('05-06-2013','dd-mm-yyyy') min_d,
      5     to_date('20-06-2013','dd-mm-yyyy') max_d
      6      from dual
      7  )
      8  --
      9  -- end of test data
     10  --
     11  select
     12     min_d + level date_x
     13  from xx
     14* connect by level<=(max_d-min_d)
    ranit@XE11GR2>> /
    
    DATE_X
    -------------------
    06-06-2013 00:00:00
    07-06-2013 00:00:00
    08-06-2013 00:00:00
    09-06-2013 00:00:00
    10-06-2013 00:00:00
    11-06-2013 00:00:00
    12-06-2013 00:00:00
    13-06-2013 00:00:00
    14-06-2013 00:00:00
    15-06-2013 00:00:00
    16-06-2013 00:00:00
    17-06-2013 00:00:00
    18-06-2013 00:00:00
    19-06-2013 00:00:00
    20-06-2013 00:00:00
    
    15 rows selected.
    
  • Getting the values MIN and MAX of the table data

    I have the table and the following records.
    create table test_bank ( trans_id  number ,   trans_date   date ,    trans_amt    number ,      debit_credit_indicator varchar2(3) )
    
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (1, TO_DATE('01/17/2013 08:02:44', 'MM/DD/YYYY HH24:MI:SS'), 1099, 'cr');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (1, TO_DATE('01/18/2013 08:03:02', 'MM/DD/YYYY HH24:MI:SS'), 800, 'cr');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (1, TO_DATE('01/19/2013 08:03:18', 'MM/DD/YYYY HH24:MI:SS'), 500, 'db');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (1, TO_DATE('01/20/2013 08:03:36', 'MM/DD/YYYY HH24:MI:SS'), 200, 'cr');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (2, TO_DATE('01/22/2013 08:04:01', 'MM/DD/YYYY HH24:MI:SS'), 400, 'db');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (2, TO_DATE('01/23/2013 08:04:16', 'MM/DD/YYYY HH24:MI:SS'), 345, 'cr');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (2, TO_DATE('01/24/2013 08:04:33', 'MM/DD/YYYY HH24:MI:SS'), 600, 'db');
    COMMIT;
    I need to get the highest and lowest credit / debit amount for each trans_id.
    I tried the SQL query below. Could you please let me know if a better solution.
    select distinct * from (
    select trans_id , case when debit_credit_indicator ='db' then  max(trans_amt) over (partition by trans_id,debit_credit_indicator )
                                 when  debit_credit_indicator ='cr' then  max(trans_amt) over (partition by trans_id,debit_credit_indicator )
                                 else null end trans_amt , debit_credit_indicator 
     from test_bank  
     union
     select trans_id , case when debit_credit_indicator ='db' then  min(trans_amt) over (partition by trans_id,debit_credit_indicator )
                                 when  debit_credit_indicator ='cr' then  min(trans_amt) over (partition by trans_id,debit_credit_indicator )
                                 else null end trans_amt , debit_credit_indicator 
     from test_bank   )
     order by trans_id
    Thank you

    Hello

    to get the answer, we need to know what is your expected results (showing an example).

    I don't know if this is appropriate for your needs:

      SELECT trans_id, debit_credit_indicator, MAX (trans_amt) trans_amt, 'MAX' min_max
        FROM test_bank
    GROUP BY trans_id, debit_credit_indicator
    UNION ALL
      SELECT trans_id, debit_credit_indicator, MIN (trans_amt)trans_amt, 'MIN' min_max
        FROM test_bank
    GROUP BY trans_id, debit_credit_indicator
    ORDER BY trans_id, debit_credit_indicator, min_max DESC;
    
      TRANS_ID DEBIT_CREDIT_INDICATOR  TRANS_AMT MIN_MAX
    ---------- ---------------------- ---------- -------
             1 cr                            200 MIN
             1 cr                           1099 MAX
             1 db                            500 MIN
             1 db                            500 MAX
             2 cr                            345 MIN
             2 cr                            345 MAX
             2 db                            400 MIN
             2 db                            600 MAX    
    

    Kind regards.
    Al

  • Find dates MIN and MAX

    Please, advise how correctly find MIN and MAX dates.
    The XML code:
    <DATES>
    <DT>2011-02-24</DT>
    <DT>2011-02-25</DT>
    <DT>2011-02-26</DT>
    <DT>2011-02-27</DT>
    <DT>2011-02-28</DT>
    </DATES>
    Model:
    <?xdoxslt:minimum(DT)?>
    <?xdoxslt:maximum(DT)?>
    The output:
    0
    20110224
    Expected results:
    2011-02-24
    2011-02-28

    Hello

    If your data is:



    2008-10-04

    1


    2009-10-21

    3


    2009-11-05

    4


    2008-11-10

    2

    The maximum is given by: / ROWSET/ROW/DT [.. / DT_RANK = count (//ROW)]
    and the minimum is: / ROWSET/ROW/DT [.. / DT_RANK = 1]

    There may be more effective, but it works.

    concerning

    Jorge

  • I restore my iphone 6s a backup of an iphone 5 s that is not mine and I find myself with iCloud account that I don't have the password

    Hello


    Restore on my new iphone 6s a backup of an iphone 5s, it's not mine and I find myself with iCloud account that I don't have the password

    When I check the status of activation lock I find OUT

    Help me please I really want to use my own icloud account and I don't know what to do

    Thank youy!

    Why did you do that? If it shows the State of activation lock as off, then put it in recovery mode and DFU mode and restore iOS using iTunes.

Maybe you are looking for