Distinct values in the Group of

Hello

How to get the number of values distinct from an RTF which is a group of loop foreach.

Kind regards

Try this

or

Tags: Business Intelligence

Similar Questions

  • OPV with distinct values for the guests

    Hi all

    Could you get it someone please let me know where/what I'm wrong. I created the couple of OPV to get distinct values, as I can't use the view that has millions of data to load guests.

    These OPV is not directly attached to my main table but joined someother tables; After you add the guests in the responses, is to show the below error

    [nQSError: 14070] can't find coverage source logical table to the columns of the logic: [bp Manager]. Please check more detailed level keys are correctly mapped. (HY000)

    I wan to the OPV use only for guests and pass the values to help requested on the main table filters

    I have no warnings/errors in my model. What could be the problem? Thank you for your time

    REDA

    Just go with PSV.

    Check it cool - bi.com for "what happens when we select all the column values.

    Table x got to join the only 1OPV then how can you expect comes from BI to the other 2 open-pollinated varieties? Likewise, we cannot write query!

    If you can create a domain for each OPV then proceed with a command prompt with the UNION of 3 open-pollinated varieties clause

  • How to set the default value for the Group of radio buttons

    Hello
    Here's my situation.
    I have a form of HTML text. In the form, I have an element called "* drinks * ' and its options in the radio button group or coffee, tea. Now, I want to put a default value("NA") to the radio of drinks group. Is it feasible. If so, how. Advice would be useful. Thank you

    Hello!

    You can also set a default value in the radio unit of page article under the default setings. Here, you must put the result value (if you have static: Café;) One, the; B, NA; C you write C if you want NA default choice) of your radio.

    concerning

  • Distinct values on the ov Type NVARCHAR2 column

    Hello

    I have a Table with an Nvarchar2 column (255) on a 10.2.0.4 database.

    I've gathered statistics on the table in different ways, with or without the histograms. I know that the table has about 65,000 distinct values, but dba_tab_col_statistics shows always 10 lines.

    For a test, I created a new column of type VARCHAR2 (255) and copied the nvarchar2 data in varchar2 column. Once I've collected statistics, and for the varchar2 column, it displays the correct value.

    any ideas?

    Concerning

    PK

    Here are some other data:
    Select count (distinct (REPOSID_XMETA)) of tmp;
    COUNT (DISTINCT (REPOSID_XMETA))
    ------------------------------
    63933

    alter table tmp add tmp_col VARCHAR2 (255);
    Modified table.

    > tmp desc

    Name Null? Type
    ----------------------------------------------------------------------------------------------------- -------- --------------------------------------------------------------------
    REPOSID_XMETA NVARCHAR2 (255)
    TMP_COL VARCHAR2 (255)

    setting a day of tmp_col set tmp = REPOSID_XMETA;
    63933 lines to date.
    Commit;
    Validation complete.
    create index tmp_index1 on tmp (REPOSID_XMETA);
    The index is created.

    create index tmp_index2 on tmp (tmp_col);
    The index is created.

    Start
    (dbms_stats.gather_table_stats)

    ownname = > 'SYS ',.
    tabname = > 'TMP ',.
    estimate_percent = > null,
    Cascade = > TRUE,
    level = > 4,
    no_invalidate = > FALSE,
    granularity = > 'AUTO',
    method_opt = > 'for all COLUMNS INDEXED");
    end; /
    Select COLUMN_NAME, DENSITY, NUM_NULLS, NUM_DISTINCT, NUM_BUCKETS in dba_tab_col_statistics where table_name = 'TMP2';
    Separate column
    Name of the density of values NUM_NULLS NUM_BUCKETS
    -------------------------------------------------- ---------- ------- ---------- -----------
    10 0 0 10 REPOSID_XMETA
    63 933 0 0 75 TMP_COL

    Published by: user1131374 on July 1, 2011 05:27

    Just read below link where joze Scheid noted that Oracle's first 32octets even after DBMS_STATS statistics in the columns of multibyte characters.

    Conclusion - converting varchar2 nvarchar2.

    http://Joze-senegacnik.blogspot.com/2009/12/CBO-oddities-in-determing-selectivity.html

    Concerning
    Girish Sharma

  • query multiple instances of the table min value using the Group of

    Hi all

    I use Oracle 10.2 on Windows 2003

    I'm trying to select the value min for a table, and if there are several occurrences of a value min, the list of all and not just a line. For example, the following query
    with test1 as(
    select to_date('2009-11-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2009-12-01','YYYY-MM-DD') t_date, 't_1' t_name, '2' t_value from dual
    union all select to_date('2010-01-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2010-02-01','YYYY-MM-DD') t_date, 't_1' t_name, '3' t_value from dual
    union all select to_date('2010-03-01','YYYY-MM-DD') t_date, 't_1' t_name, '4' t_value from dual
    union all select to_date('2010-04-01','YYYY-MM-DD') t_date, 't_1' t_name, '5' t_value from dual
    union all select to_date('2010-05-01','YYYY-MM-DD') t_date, 't_1' t_name, '6' t_value from dual
    union all select to_date('2010-06-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2010-07-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    )
    select trunc(t_date,'YYYY') t_date, min(t_value) min_value
    from test1
    group by trunc(t_date,'YYYY') 
    gives the following results
    t_date         min_value
    ---------         --------------
    01-JAN-09    1
    01-JAN-10    1
    then I looked at the forums and tried the following query
    with test1 as(
    select to_date('2009-11-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2009-12-01','YYYY-MM-DD') t_date, 't_1' t_name, '2' t_value from dual
    union all select to_date('2010-01-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2010-02-01','YYYY-MM-DD') t_date, 't_1' t_name, '3' t_value from dual
    union all select to_date('2010-03-01','YYYY-MM-DD') t_date, 't_1' t_name, '4' t_value from dual
    union all select to_date('2010-04-01','YYYY-MM-DD') t_date, 't_1' t_name, '5' t_value from dual
    union all select to_date('2010-05-01','YYYY-MM-DD') t_date, 't_1' t_name, '6' t_value from dual
    union all select to_date('2010-06-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2010-07-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    )
    select t_date,min_value
    from (select t_date,min(t_value) min_value,
    rank() over (order by min(t_value) ASC) RN
     from test1 group by t_date)
    where rn=1
    I get the results you want with this query, which are
    t_date           min_value
    ---------           --------------------
    01-NOV-09     1
    01-JAN-10      1
    01-JUN-10      1
    01-JUL-10       1
    the problem is, when I change the values in the table test1 as follows
    with test1 as(
    select to_date('2009-11-01','YYYY-MM-DD') t_date, 't_1' t_name, '123' t_value from dual
    union all select to_date('2009-12-01','YYYY-MM-DD') t_date, 't_1' t_name, '2' t_value from dual
    union all select to_date('2010-01-01','YYYY-MM-DD') t_date, 't_1' t_name, '21' t_value from dual
    union all select to_date('2010-02-01','YYYY-MM-DD') t_date, 't_1' t_name, '13' t_value from dual
    union all select to_date('2010-03-01','YYYY-MM-DD') t_date, 't_1' t_name, '24' t_value from dual
    union all select to_date('2010-04-01','YYYY-MM-DD') t_date, 't_1' t_name, '15' t_value from dual
    union all select to_date('2010-05-01','YYYY-MM-DD') t_date, 't_1' t_name, '26' t_value from dual
    union all select to_date('2010-06-01','YYYY-MM-DD') t_date, 't_1' t_name, '100' t_value from dual
    union all select to_date('2010-07-01','YYYY-MM-DD') t_date, 't_1' t_name, '2' t_value from dual
    )
    select t_date,min_value
    from (select t_date,min(t_value) min_value,
    rank() over (order by min(t_value) ASC) RN
     from test1 group by t_date)
    where rn=1
    I get the following results
    t_date          min_value
    ----------         -------------
    01-JUN-10     100
    I expected to get the results
    t_date         min_value
    --------          --------------
    01-DEC-09     2
    01-JUL-10      2
    any help would be appreciated

    See you soon

    Hello

    The string "100" comes before "2" in the sort order for the same reason that 'ALL' comes before 'B '.

    If you want to t_value a number, make a NUMBER, not a VARCHAR2 column.

    I f you can do that, then you can try to use TO_NUMBER to convert it to a NUMBER.
    but you will get an error if Island column already contains everything that cannot be interpreted as a NUMBER.

  • Count (1) returns the null value in the Group of

    Hi the gems... Good afternoon...

    I read that the COUNT() function always returns 0 (zero) if there is no corresponding row in the table.

    The following code returns 0 as expected:
    SELECT COUNT(1) FROM book_table
                 WHERE client_id = 10009
                   AND book_id = 5465465
                   AND book_sub_id = 'gfdf'
                   AND amount = 78686
    But when I used the GROUP BY clause in the query, then he returned to nothing:
    SELECT COUNT(1) FROM book_table
                 WHERE client_id = 10009
                   AND book_id = 5465465
                   AND book_sub_id = 'gfdf'
                   AND amount = 78686
    group by client_id,book_id,book_sub_id,amount
    Why this is happening... Please suggest...

    When you use just rely on its own (and you must use count (*) not count (1) as the optimizer based on CSSTidy will re - write internally to count (*) anyway)... then you say you want a count of all rows.

    When you introduce the group by clause you say thay want returned a number of records within specific groups... but if there are no groups, he cannot give you a line for any group with its county equivalent, because there are no lines for the groups. With the grouping, you have must have at least 1 row per group to get an account for her.

  • Distinct values in group by

    Hello

    I would like to know if there is a way to get the result I want with a query. I'm on Oracle 10 g.
    Here's a simplified example:
    SELECT A, SUM(DISTINCT B+C) FROM(
    SELECT 1 AS A, 2 AS B, 3 AS C FROM DUAL
    UNION ALL
    SELECT 1 AS A, 2 AS B, 3 AS C FROM DUAL
    UNION ALL
    SELECT 1 AS A, 3 AS B, 2 AS C FROM DUAL
    UNION ALL
    SELECT 2 AS A, 2 AS B, 3 AS C FROM DUAL
    UNION ALL
    SELECT 2 AS A, 4 AS B, 1 AS C FROM DUAL
    )
    GROUP BY A
    With this query, I get two lines with values (1, 5) and (2.5) and it's OK but I want the query to calculate B + C only the DISTINCT values, so the result I want in this example would be:
    A AND B
    - - - - -
    1 10
    2 10

    How can I do?

    Thank you.

    OK, try this:

    with my_tab as (select 1 as a, 2 as b, 3 as c from dual
                    union all
                    select 1 as a, 2 as b, 3 as c from dual
                    union all
                    select 1 as a, 3 as b, 2 as c from dual
                    union all
                    select 2 as a, 2 as b, 3 as c from dual
                    union all
                    select 2 as a, 4 as b, 1 as c from dual)
    select a r1, sum(b) r2, count(distinct a||' '||b||' '||c) r3, sum(decode(rn, 1, power(b, c))) r4
    from   (select a, b, c, row_number() over (partition by a, b, c order by b, c) rn
           from   my_tab)
    group by a
    
    R1     R2     R3     R4
    1     7     2     17
    2     6     2     12
    
  • Disable certain value in the Radio button group

    Hello

    Is it possible to have a group of radio buttons but have certain values with disabilities while they are displayed but cannot be selected while other values in the Group of radio buttons are selectable.

    I know that I could have two groups of radio next to each one showing the selectable values and another next to it showing disabled values but I'd rather have a radio group so that the values are in order.

    We currently use apex 4.2.5.00.08

    Thanks in advance

    where to enjoy a group of radio buttons with three values

    Yes, no, both

    so it's the two of us, without deactivation function

    -on your condition

    real action in dynamic action

    run javascript

    $("#P2_CHOOSE_STATUS_"+0).attr ("disabled", true);

    $("#P2_CHOOSE_STATUS_"+1).attr ("disabled", true);

    P2_CHOOSE_STATUS IS THE NAME OF THE ELEMENT

  • mark the first value of a group

    I get the following
    16:57:28 >r
      1  with my_table as
      2       (
      3      select 'M082012' pera, to_number(10584338) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all
      4      select 'M092012' pera, to_number(15965177) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all
      5      select 'M082012' pera, to_number(14254501) snr, to_number(20) pnr, 'Wallen' name, 'Monika' f_name from dual union all
      6      select 'M082012' pera, to_number(10584339) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all
      7      select 'M092012' pera, to_number(15965178) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all
      8      select 'M012013' pera, to_number(10674833) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all
      9      select 'M012013' pera, to_number(10674834) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all
     10      select 'M012013' pera, to_number(10539210) snr, to_number(30) pnr, 'Klose' name, 'Werner' f_name from dual union all
     11      select 'M012013' pera, to_number(12345678) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all
     12      select 'M012013' pera, to_number(22345789) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all
     13      select 'M082012' pera, to_number(10584346) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all
     14      select 'M062012' pera, to_number(10550971) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all
     15      select 'M092012' pera, to_number(15965185) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all
     16      select 'M082012' pera, to_number(10584352) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all
     17      select 'M092012' pera, to_number(15965191) snr, to_number(80) pnr, 'Duster' name, 'Hucke' f_name from dual)
     18  select case when pera = 'M012013' then '*' end mark,
     19         pera, snr, pnr, name, f_name
     20  from (
     21        select pera, snr, pnr, name, f_name,
     22               max(case when pera = 'M012013' then 'Y' end)
     23                 over(partition by upper(name||f_name)) m_flag,
     24               count(*) over(partition by upper(name||f_name)) cnt
     25        from my_table
     26       )
     27  where m_flag = 'Y'
     28  and cnt > 1
     29* order by 4,5,6, to_number(substr(pera,4,4)||substr(pera,2,2)) desc
    
    MARK  PERA           SNR        PNR NAME   F_NAME
    ----- ------- ---------- ---------- ------ ------
    *     M012013   10674834         15 Tester Toni
    *     M012013   10674833         15 Tester Toni
          M092012   15965177         15 Tester Toni
    *     M012013   22345789         50 Meier  Otto
    *     M012013   12345678         50 Meier  Otto
          M082012   10584352         50 Meier  Otto
    I would like to mark only the first value in the group with an asterisk as follows.
    MARK  PERA           SNR        PNR NAME   F_NAME
    ----- ------- ---------- ---------- ------ ------
    *     M012013   10674834         15 Tester Toni
          M012013   10674833         15 Tester Toni
          M092012   15965177         15 Tester Toni
    *     M012013   22345789         50 Meier  Otto
          M012013   12345678         50 Meier  Otto
          M082012   10584352         50 Meier  Otto

    Perhaps this example might be useful for you. the code uses the same code that you published with additional analytical query to return the row grouping for the name, the NRP and columns pera. then use that line number to determine which will be placed at the first mark.

    SQL>   with my_table as
      2         (
      3        select 'M082012' pera, to_number(10584338) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all
      4        select 'M092012' pera, to_number(15965177) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all
      5        select 'M082012' pera, to_number(14254501) snr, to_number(20) pnr, 'Wallen' name, 'Monika' f_name from dual union all
      6        select 'M082012' pera, to_number(10584339) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all
      7        select 'M092012' pera, to_number(15965178) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all
      8        select 'M012013' pera, to_number(10674833) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all
      9        select 'M012013' pera, to_number(10674834) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all
     10        select 'M012013' pera, to_number(10539210) snr, to_number(30) pnr, 'Klose' name, 'Werner' f_name from dual union all
     11        select 'M012013' pera, to_number(12345678) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all
     12        select 'M012013' pera, to_number(22345789) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all
     13        select 'M082012' pera, to_number(10584346) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all
     14        select 'M062012' pera, to_number(10550971) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all
     15        select 'M092012' pera, to_number(15965185) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all
     16        select 'M082012' pera, to_number(10584352) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all
     17        select 'M092012' pera, to_number(15965191) snr, to_number(80) pnr, 'Duster' name, 'Hucke' f_name from dual)
     18    select case when pera = 'M012013' and rn = 1 then '*' end mark,
     19           pera,
     20           snr,
     21           pnr,
     22           name,
     23           f_name
     24      from (select pera, snr, pnr, name, f_name,
     25                   row_number() over (partition by pera, pnr, name, f_name order by pera, pnr, name) rn
     26              from (select pera, snr, pnr, name, f_name,
     27                           max(case when pera = 'M012013' then 'Y' end)
     28                           over(partition by upper(name||f_name)) m_flag,
     29                           count(*) over(partition by upper(name||f_name)) cnt
     30                      from my_table)
     31                     where m_flag = 'Y'
     32                       and cnt > 1
     33             order by 4,5,6, to_number(substr(pera,4,4)||substr(pera,2,2)) desc)
     34    order by 4,5,6, to_number(substr(pera,4,4)||substr(pera,2,2)) desc;
    
    MARK PERA           SNR        PNR NAME   F_NAME
    ---- ------- ---------- ---------- ------ ------
    *    M012013   10674834         15 Tester Toni
         M012013   10674833         15 Tester Toni
         M092012   15965177         15 Tester Toni
    *    M012013   22345789         50 Meier  Otto
         M012013   12345678         50 Meier  Otto
         M082012   10584352         50 Meier  Otto
    
    6 rows selected
    
    SQL> 
    
  • Return distinct values in a fuction

    Hi all

    I create a function, where it must take two parameters of the input string and return the distinct values of the two channels

    input parameters are: 2.71A2, 2.71X15, 2.71x15 and 2.71A2, 2.71X15, 2.71a2

    I get the output as 2.71A2 parameters, 2.71X15

    need to convert lower case to upper case and compare.

    post needed more information.

    Thank you.

    One way is:

    Select listagg (ds, ",") the Group (control 1)

    from (select distinct superior (REGEXP_SUBSTR (s, "[^,] +', 1, rownum")) ds)

    from (select '2.71A2, 2.71X15, 2.71x15, 2.71A2, 2.71X15, 2.71a2's)

    the double)

    connect by INSTR (s, ',', 1, level - 1) > 0

    and prior sys_guid() is not null)

    Another way xmlquery

    ----

    Ramin Hashimzade

  • Problem with my account and the Group of

    Hey there,

    I have some difficulties to group by my result, and I ask for assistance in this forum.

    My table is really simple, have an Ilie and a COM domain that contain the string with line breaks. I want to count the number of group ResId by COM.

    My data in my table store have look like this:

    RESOURCE TABLE:
    ResId. COM
    1. Server: Walcot15.\nCOD M50
    2. Server: Walcot15.\nCOD M55
    3. Server: Walcot16.\nCOD M55

    I would like to get as a result:

    Count (RESID) | COM
    2. Server: Walcot15.
    1. Server: Walcot16.

    First of all, I did substr in order to keep only the string that contains the server and not the \nCOD...


    SELECT
    County (RES. (' ' ID ') as "ResId".
    substr (RES. CMT, 0, instr (RES. CMT, Chr (10))) as 'COM '.

    Of

    RES THE RESOURCE

    WHERE

    REGEXP_LIKE (RES. ("' CMT ', 'Server', 'i')

    Group (RES. "" THE ID ", RES. CMT)
    order by
    1

    The problem is not count and group by server. Anyone help me, please?

    Kind regards
    Jarod.

    Hello

    When you assign a column alias (for example, COM) in a query, you can't reference this alias in the same query (except in the ORDER BY clause). It is necessary to repeat the expression or affect the aliases in a subquery. Then, you can use the alias in any part of the request of the mother.
    For example:

    WITH     got_com          AS
    (
         SELECT     id
         ,     SUBSTR ( cmt
                     , 1
                     , INSTR (cmt, '\') - 1
                     )     AS com          -- Alias defined
         FROM     resources
         WHERE     INSTR ( UPPER (cmt)
                    , 'SERVER'
                    )     > 0
    )
    SELECT       COUNT (id)     AS count_resid
    ,       com                         -- Alias referenced
    FROM       got_com
    GROUP BY  com                         -- Alias referenced
    ORDER BY  com                         -- Alias referenced
    ;
    

    Output:

    COUNT_RESID COM
    ----------- ------------------------------
              2 Server : Walcot15.
              1 Server : Walcot16.
    

    If the idea is to have a production line for evry value distinct from com, the GROUP BY clause should not contain anything except com

    You will notice that I used SUBSTR and INSTR, above, in the places where you can also use regular expressions. This is because regular expressions tend to be much slower. If the speed is not a problem, and you prefer to use REGEXP_SUBSTR or REGEXP_LIKE, then it is fine to use.

  • Drop Dynamics: distinct values

    Hello everyone. Newb here.

    I just started to work on a dynamic web page in Dreamweaver CS3. I use WAMP (MySQL/PHP). I have my web page set up, plugged in and everything works fine.

    I just created a drop-down menu to display the dynamic value (State) of my recordset. My table related to this recordset has a bunch of files with one of the fields in the State. There are several records of each State. When I saw the page in the browser, the menu displays the State of my table, but it displays each status several times (no doubt the number of records that come from that State). Here's the question:

    How can I get this drop-down menu to display the distinct values for the State field?

    i.e. show LA, MS, TX, GA instead of, THE, THE, THE, LA, MS, MS, MS, MS, TX, TX, GA, GA, GA

    Any help would be greatly appreciated.

    Hello kmcamara86

    Yes you place the Select Distinct in the wrong place. The "Select".

    Separate must be in the recordset for the drop, not the drop-down list.

    Open the recordset in the data tab, and then click Advanced to

    the Recordset. Change the sql statement for

    "SELECT DISTINCT (state) FROM table_name";

    If you can email me the code for your page, I can change the

    record set for you.

    Thank you

    Stan Forrest

    Digital magic show

    Phone: (661) 979-8891

    E-mail: [email protected]

    Web: http://www.digitalmagicshow.com

    Our desire is to exceed your expectations

  • Display the value of the separate element

    Hi all
    I'm having a problem of display of a distinct value for the element "PK_EMPL_ID". I need all the items below because I pass these values to another page in the APEX. But I need help with the syntax of the statement select.
    SELECT hs.pk_session_id,
           hsp.pk_session_process_id,
           hs.fk_class_id,
           hsm.pk_empl_id,
           hsm.last_name || ', ' || hsm.first_name studentname,
           dg.department_group_descr,
           pd.department_descr,
           hsm.fk_dept_group,
           hsm.fk_dept_code,
           hsp.fk_empl_id,
           hs.session_meridiem,
           hsn.session_name,
           hs.session_date,
           hsp.session_process_status
        FROM   hrt_session hs, 
               hrt_session_name hsn, 
               hrt_session_process hsp,
               hrt_student_master hsm,
               cobr.department_group dg,
               cobr.pps_department pd
        WHERE  hsn.pk_session_name_id = hs.fk_session_name_id
           AND hsp.fk_session_id = hs.pk_session_id
           AND hsp.fk_empl_id = hsm.pk_empl_id
           AND hsm.fk_dept_group = dg.pk_department_group_id
           AND hsm.fk_dept_code = pd.pk_department_id
    My output is as:
    -PK_EMPL_ID-
    JOHN
    JOHN
    JOHN
    BOBBY
    JAMES

    I only want to display each 'PK_EMPL_ID' value once when the select statement is executed, not duplicates. I tried separate, the band etc... but I have a problem since I'm on several tables using foreign keys. I've seen a few threads but they treat only one or two values of a table element. Can someone help me with please? Thanks advance.

    Hello

    Whenever you have any questions, post a small example of data (CREATE TABLE and INSERT statements) for all tables, and the results uyou want from these data.
    You can have a clear idea where you come from and where you want to go, but the only description doesn't transmit than clear idea for us.

    Alternatively, you can rephrase your question regarding other commonly available tables, as scott.emp.
    For example: "I make this request on scott.emp:
    {code}
    Job SELECTION
    deptno
    FROM scott.emp
    ;
    {code}
    How can I get only 1 row by separate? »

    Without example output, the question is still vague.
    There are 14 ranks in scott.emp.
    You can reduce the output to 9 lines in "SELECT" changing to ' SELECT * DISTINCT * ":

    SELECT DISTINCT
         job
    ,     deptno
    FROM     scott.emp
    ;
    

    which produces:

    OB           DEPTNO
    --------- ----------
    MANAGER           20
    PRESIDENT         10
    CLERK             10
    SALESMAN          30
    ANALYST           20
    MANAGER           30
    MANAGER           10
    CLERK             30
    CLERK             20
    

    But that's as far as you can go without changing the results.
    For example, all three departments have managers. If you want only 5 rows of outptu (one for each of the 5 separate jobs), then what deptno do you want?

    If you want the lowest one, here's a way to do it:

    WITH     got_rnum     AS
    (
         SELECT     job
         ,     deptno
         ,     ROW_NUMBER () OVER ( PARTITION BY  job
                                   ORDER BY          deptno
                           ) AS rnum
         FROM    scott.emp
    )
    SELECT     job
    ,     deptno
    FROM     got_rnum
    WHERE     rnum     = 1
    ;
    

    Output:

    JOB           DEPTNO
    --------- ----------
    ANALYST           20
    CLERK             10
    MANAGER           10
    PRESIDENT         10
    SALESMAN          30
    

    There are other apprioaches to this problem, too. The advantage of this is that it works well with any number of columns in the output.

  • different values on the same grouping column

    Hi all

    I have a requirement to find different recordings of the same grouping columns have value different values in the columns, for example:

    WITH

    Data (G1, COL)

    AS

    (

    SELECT 'A', '456' FROM dual UNION ALL

    SELECT 'A', '345' FROM dual UNION ALL

    SELECT 'A', ' ' FROM dual UNION ALL

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT 'C', "789' FROM dual UNION ALL

    SELECT 'C', "789' FROM dual UNION ALL

    SELECT 'C', "" the DOUBLE

    )

    Select g1, pass data

    Ideally for G1 = A, the NECK should have that a single value across records ' 456 'or ' 345'. So I need to check the values in NOT NULL of the COL where, for any value of G1, we have different values of the colonel G1 = 'B' is perfectly fine, so I don't need. G1 = C is good too and I'm not worried about it. I only need these entries when the neck was non-empty value / NULL not different for the same value of G1.

    So expected out put is

    Capture.PNG

    WITH

    Data (G1, COL)

    AS

    (

    SELECT 'A', '456' FROM dual UNION ALL

    SELECT 'A', '345' FROM dual UNION ALL

    SELECT 'A', "double UNION ALL

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT 'C', "789' FROM dual UNION ALL

    SELECT 'C', "789' FROM dual UNION ALL

    SELECT 'C', "the DOUBLE

    )

    Select g1,

    Col

    de)

    Select g1,

    Col,

    Count (distinct trim (col)) at the NTC (g1 partition)

    from the data

    )

    where NTC! = 1

    and trim (col) is not null

    /

    G COL. NO.
    - ---
    A 345
    A 456

    SQL >

    SY.

  • Select the records from the first n distinct values of column

    I need to write a query in plsql to select records for the first 3 values distinct from a single column (example below, ID) and all lines for the next 3 distinct values of column and so on until the end of the number of distinct values in a column.
    for example:
    Age of name ID
    1 abc 10
    1 def 20
    2 IA 10
    2 20 JKL
    2 mno 60
    3 10 pqr
    4 the RST 10
    4 10 TÜV
    5 vwx 10
    6 10 XYZ
    hij 6 10
    7 lmn 10
    .
    .
    .
    so now... (up to a few County)
    Result must be
    1 the application should result->
    Age of name ID
    1 abc 10
    1 def 20
    2 IA 10
    2 20 JKL
    2 mno 60
    3 10 pqr

    Query 2 should lead to->
    4 the RST 10
    4 10 TÜV
    5 vwx 10
    6 10 XYZ
    hij 6 10

    Query 3 should lead to->
    7 lmn 10
    .
    .
    9... ..
    so now...
    How to write a query for this inside a loop.

    Hello

    Thus, a panel will consist of the lowest id value, the 2nd lowest and the 3rd lower, reggardless of how many lines is involved. The next group will include the 4th lowest id, the 5th lowest and the 6th lowest. To do that, you must assign the numbers 1, 2, 3, 4, 5, 6,... for the rows in order by id, with all lines with the same id, getting the same number and without jumping all the numbers.
    This sounds like a job for the analytical DENSE_RANK function:

    WITH     got_grp_id     AS
    (
         SELECT     id, name, age
         ,     CEIL ( DENSE_RANK () OVER (ORDER BY id)
                   / 3
                   )          AS grp_id
         FROM     table_x
    )
    SELECT     id, name, age
    FROM     got_grp_id
    WHERE     id     = 1     -- or whatever number you want
    ;
    

    If you would care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
    See the FAQ forum {message identifier: = 9360002}

Maybe you are looking for

  • After upgrade ram, iMac start 3 beeps

    Hi guys, I try to improve my ram from 8G to 32G with the new memory locations. It went very well. I was put in place the RAM and it worked very well. I put my PC on sleep, and then I wake up with strange beeps. I had to stop. I try to start it again,

  • Beats Audio software and drivers

    My daughter has an HP Envy 15 - u011dx x 360 system 64 bit 8 was on it when she bought I think (about 2 years) and it came with the software audio beats. She had to do a clean install of 10 can I but when she went on the HP support site it came and s

  • enum type_def in 2013 CVI build error

    Hello I'm encoutering a problem that seems to be specific to the version number of LabWindows/CVI. I have attached the code and the problem I encounter is that I get failures in Build for the use of an enum type_def that is already declared in a head

  • Upgrade Vista Home Premium to Ultimate - Windows complete PC Backup and Restore

    Dear Madam, dear Sir Upgraded my laptop HP DV7 Vista Home Premium to Ultimate, mainly to use Windows complete PC Backup and Restore. The restore time and unfortunately no option in the boot menu at startup to restore system from images. No menu advan

  • Black screen with the underscore flashing in the upper right corner - HELP!

    Prouct name - laptop HP 2000-299WM Product number - QE282UA #ABA Operating system-Windows 7, 64 bit. No error message. No recent changes before the problem occurred. -For starting, my laptop goes to the screen with the logo blue HP and then straight