get the group instead of values in a column

How can I get the other group instead of values in a single column in a query?
as

Name (name) count, subjectid
aaaa            5                             1,2,5,9,10
bbb             2                                6,9


Here the object id is a column in a table.
I did to show


Name count (name)
AAAA 5
BBB 2


But how can I get the third column?
Help me.im in trouble.

Thanks in advance

I think the OP want also the number of the subject.

 SQL>with subject_table as ( select 101 studentId, 1 subjectId, 'Sub1' SubjectName from dual
  2  union all             select 101, 2 , 'Sub2'  from dual
  3  union all             select 101, 5 , 'Sub5'  from dual
  4  union all             select 101, 9 , 'Sub9'  from dual
  5  union all             select 101, 10 , 'Sub10' from dual
  6  union all             select 102, 6 , 'Sub6' from dual
  7  union all             select 102, 9 , 'Sub9'  from dual
  8  ) ,
  9  student_table as ( select 101 studentId, 'aaa' StudentName from dual
 10  union all          select 102, 'bbb' from dual
 11  )
 12  select StudentName, max(nameCounts) NameCounts,
 13     TRIM( trailing ',' from XMLAGG(XMLELEMENT(a,SubjectID||',').extract('//text()'))) SubjectID
 14  from (
 15  select StudentName, count(*) over (partition by StudentName order by StudentName) NameCounts
 16  , subjectID
 17  from student_table a, subject_table b
 18  where a.StudentId = b.StudentID
 19  )
 20* group by Studentname
SQL> /

STU NAMECOUNTS SUBJECTID
--- ---------- ----------------------------------------
aaa          5 1,2,5,10,9
bbb          2 6,9

SS

Tags: Database

Similar Questions

  • When you press the new tab, how can I get the homepage instead of the history of tiles?

    When you press the new tab, how can I get the homepage instead of the history of tiles?

    You can try this.

    Instead of the parameter mentioned pref in about: blank, you can enter any site of your choice.

    Ex: encrypted.google.com

  • Get the groups and group of father

    Hello!!

    In my process:

    1. I need get the group name given a username (userId)

    2 if I have the groupName can I get the name of Group of father, right?

    3. If I have a group name of father that I can get the members of a group. right?

    Well, I can not find the operations that I need to make my algoritm to assign the task.

    Can someone help me?

    Thank you very much

    Maria

    HI Maria,

    You can get the name of the Group of the user name.

    For that you need to access the basis of Adobe.

    Select refparentprincipalid in the EDCPRINCIPALGRPCTMNTENTI where refchildprincipalid = 'user name'.

    The output for this would be refparentprincipalid.

    Now,.

    Select commonname EDCPRINCIPALENTITY where id = "refparentprincipalid".

    This will give you the name of the group.

    Hope this will help you.

    Regrads-

    Chalukya

    Post edited by: chalukya

  • get the length of each string in a column

    Hi all

    Is there a way to get the length of each string in a column:

    for example:

    If the table contains lines like below:

    Select 'test test1 test31' col1 of double

    Union of all the

    Select 'sectest1 sectest234' double col1

    The output should be as below:

    col1

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

    4 5 6

    8 10

    That is to say get the count of each separated from the chain of space in a column. Is this possible using regexpr_substr?

    Thanks in advance.

    Roy.

    Try the below

    SELECT LISTAGG(val1,' ') IN ONE GROUP)

    New_val ORDER BY lvl)

    Of

    (SELECT LENGTH (REGEXP_SUBSTR (col1,'[^] +', 1, LEVEL)) val1,)

    RN,

    LEVEL lvl

    Of

    (SELECT col1,

    ROWNUM rn

    Of

    (SELECT 'test test1 test31' col1 OF double)

    UNION ALL

    SELECT 'sectest1 sectest234' double col1

    )

    )

    CONNECT BY LEVEL<= regexp_count(col1,'="">

    AND PRIOR rn = rn

    AND PRIOR DBMS_RANDOM. VALUE IS NOT NULL

    )

    GROUP BY rn;

    OUTPUT:-

    =======

    col1

    ----

    4 5 6

    8 10

    Thank you

    Ann

  • Get the master table field value

    Hi all.

    I have a form with 2 tables of ADF (A and B), and they have a master relationship / detail.

    I need to put the property readonly on B (detail) table based on a (status) value in the current table (master) A line. I can't find "#{row.bindings.Status.inputValue}" expression editor for the table is placed on B.

    So, how can I get the value of the status field on the current line of the table to use in a table expression B?

    Sorry if this is obvious, but I'm new to ADF.

    Thanks in advance.

    You should not use #{row.bindings.Status.inputValue} in table 2 row var is local to table 1.
    Instead add a binding for the State attribute (according to table 1) in the pageDef and use it as an EL in table 2 # {bindings. Status.inputValue}... it will represent the currently selected line in table1.

  • How to get the whole text of value special hashi

    Hello

    can someone let me know how to get the full text of sql data hash_value in report statsapck...
    SQL> select SQL_TEXT from v$sql where HASH_VALUE=3102119461;

    SQL_TEXT
    --------------------------------------------------------------------------------

    SELECT ROWID,AR_DT,AR_TXN_CODE,AR_NO,AR_AMD_NO,AR_REF_FROM,AR_REF_TXN_CODE,AR_RE

    F_NO,AR_DAK_CODE,AR_DED_SYS_ID,AR_COMP_CODE,AR_ACNT_YR,AR_AMD_DT,AR_AMD_UID,AR_A

    MD_RES_CODE,AR_REF_SYS_ID,AR_STUD_SRN,AR_APPL_DT,AR_ISSUE_DT,AR_ENROL_FRM_COURSE

    ,AR_ENROL_DT,AR_JOURNAL_YN,AR_TYPE,AR_TITLE,AR_VACANCY_CODE,AR_MRH_MRN,AR_INDUST

    RY_FIRM,AR_DEED_FM_DT,AR_DEED_TO_DT,AR_IT_TR_YN,AR_IT_START_DT,AR_CONDN_YN,AR_RE

    MARKS,AR_IT_END_DT,AR_CONDN_DAYS,AR_CONDN_AMT,AR_CONDN_DT,AR_CONDN_BY,AR_46_FLAG

    ,AR_RE_REG_YN,AR_DOC_STATUS,AR_ART_TERM_COMPLN,AR_TERMN_COMPLNPLN_DT,AR_CORRES_A

    DDR_LINE_1,AR_CORRES_ADDR_LINE_2,AR_CORRES_ADDR_LINE_3,AR_CORRES_CITY_CODE,AR_CO

    RRES_ZIP_POSTAL_CODE,AR_CORRES_BR_CODE,AR_CORRES_REGION_CODE,AR_CORRES_STATE_COD

    E,AR_CORRES_COU_CODE,AR_CORRES_TEL,AR_CORRES_EMAIL,AR_CORRES_MOBILE,AR_PER_ADDR_

    LINE_1,AR_PER_ADDR_LINE_2,AR_PER_ADDR_LINE_3,AR_PER_ADDR_LINE_4,AR_PER_CITY_CODE


    SQL_TEXT
    --------------------------------------------------------------------------------

    ,AR_PER_ZIP_POSTAL_CODE,AR_PER_BR_CODE,AR_PER_REGION_CODE,AR_PER_STATE_CODE,AR_P

    ER_COU_CODE,AR_PER_TEL,AR_APPR_DT,AR_AP


    SQL>

    You can query V$ SQLTEXT or V$ SQLTEXT_WITH_NEWLINES

    Thus

    select sql_text
    from v$sqltext
    where hash_value='&hash_value'
    and address='&address'
    order by piece;
    

    Note: In 10g and more, you can use instead of HASH_VALUE SQL_ID and ADDRESS.

    Additonally, in 10g and above, you can also query V$ SQLSTATS where the text is stored in a CLOB called 'SQL_FULLTEXT', we must therefore DEFINE the LONG value when using SQLPlus.

  • I can not connect to my computer laptop get "the Group Policy client service has no connection. Access denied. "

    I can not connect on my lapto even if the password is correct. I'm getting "the political group Clinet impossible service connection access Denined.

    Original title: I can not connect on my laptop even if the password is correct

    HI, John Angelo2,.

    Try rebooting and tapping F10 to achieve the recovery screen

    You can choose to repair or restore your system

    Select Restore to an earlier time

    If it is impossible to do the above, use the installation start screen repair DVD

    This problem is caused by your user profile/registry settings/system files corruption

    Response of Mouneshawar R.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-security/the-Group-Policy-client-service-failed-the-logon/6b069a74-8524-442c-8ff1-d723e2a4e992

    Re-create the profile or restore the file ntuser.dat from the back to the top

    http://social.technet.Microsoft.com/forums/en-us/itprovistaapps/thread/c88515b4-4be7-4f6f-9988-80f8a5683b41/

    You can post on the Technet forum for help

    How to customize the default local user profile when you prepare an image of Windows Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2

    http://support.Microsoft.com/kb/973289

    Assign a mandatory user profile

    http://TechNet.Microsoft.com/en-us/library/cc786301 (WS.10) .aspx

    http://support.Microsoft.com/kb/307800

    http://msdn.Microsoft.com/en-us/library/bb776895 (v = vs. 85) .aspx

  • Get the towel instead of new file Windows 7 64 bit

    When I right click main file, and then click New, I get a towel instead of a new file icon.  Cannot figure out how to fix it.  Think that it's part of synchronization that I never use.

    Hello Gil,.

    No need to feel like a fool. Looks like you did exactly what he needed – by clicking on the green tick is the equivalent of a button "Finish". Assuming you have checked 'Create a new folder' which should now appear in your context menu.

    You can access the configuration screen by going to the Start Menu and clicking on the FileMenu Tools. If not, how can I help?

    Kind regards

    BearPup

  • get the selection instead of the puppet pin tool marquee tool

    I imported a png file in the new composition and wanted to distort the image with the puppet tool, but instead of the puppet pin tool that I always get the marquee tool

    tried to keep Alt, Shift, Ctrl, did not help

    puppet pin tool works fine on the other compositions. It's the first time I encounter such a problem with the puppet tool. What is going on?

    AE CS6 on win7

    First question, what size is this file? I don't see any dimension.

    Second question, it is necessary to have layers in this picture? Looks like you apply puppet pin on the entire fly.

    Third question, have you tried to reduce the size of the file in Photoshop to about the size of your computer and then saving it as a png 24-bit or single-layer PSD or tiff with an alpha channel?

    It is difficult to know because there is no detail about right PSD, but it could be wrong, too much color space, or have another problem that I don't see.

  • I get form field instead of values of form fields names

    How to get the value of a form field called with a variable somewhere in the names of the fields?

    < isDefined ('form.btnBlokvelden') cfif >
    < variable cfxml = casesensitive "config4XML" = "no" >
    < blokvelden >
    < cfloop index "i" = from = '1' to '25' = >
    < cfset bvNummer = #i # >
    < cfset bvActief = "form.bv #i #actief" >
    < cfoutput >
    Nummer - #bvNummer # < br >
    Actief - #bvActief # < br >
    < / cfoutput >
    < / cfloop >
    < / blokvelden >
    < / cfxml >
    < / cfif >

    Thank you

    Pope

    Hello

    Try #Evaluate (bvActief) #... It'll be...

  • Cannot move the bookmarks in the bookmarks toolbar... I get the slash instead

    When I try to drag a web address in the bookmarks toolbar... I get the circle with a slash in there... I can't add all the bookmarks in the bookmarks toolbar. This never happened in older versions of the combustion chamber, only in version 31. Any help? Thank you!

    See you again all bookmarks in the bookmarks toolbar?

    Make sure the toolbars as the 'personal bar' are visible.

    • Firefox '3-bar' menu button > customize > show/hide toolbars
    • View > toolbars
      Press the ALT key, or press F10 to display the Menu bar
    • Right click on empty toolbar space

    Open the Customize and set the toolbar to display items.

    • Firefox '3-bar' menu button > customize
    • Make sure the "bookmarks toolbar items" are on the personal bar
    • If "Bookmarks Toolbar items" is not on the bookmarks toolbar, then FRY it in the palette to customize the window customize to the bookmarks toolbar
    • If the missing elements are in the palette to customize then drag them back into the window to customize the toolbar
    • If you don't see an item on a toolbar in the Customize palette, then click on the "restore default settings" button to restore the default toolbar configuration
  • How to get the characters between specific characters in a column?

    A column in a table has values like these:
    1/F/E/WS/A. /
    2 F/BV/DFER/E/C/C/V /.
    3 BN/JK/T/E/R/E/QW /.

    How can I get the values this table:
    D
    V
    QW
    These are the characters between the last two /'s.

    You are looking for something like this?

    with yourtable as
    (
    select 'A/F/E/WS/D/' yourcolumn from dual union all
    select 'F/BV/DFER/E/C/C/V/' yourcolumn  from dual union all
    select 'BN/JK/T/E/R/E/QW/' yourcolumn  from dual
    )
    select rtrim(regexp_substr(yourcolumn, '[^/]*/$'),'/')
    from yourtable;
    
  • Can someone show me how to get the data of this vi in four columns in a spreadsheet file.

    I'm trying to get the data into four columns on a worksheet. The data consists of two channels and two measures, a maximum voltage and a voltage after x seconds. I enclose the code. Any help would be great. Thank you.


  • How to get the date of request for a date column

    I have a requirement where I need to filter the data between two guests to date. I have only a single column of date and the date in the guests should be chosen by the calendar.
    I saw may approaches to do this, and I have one where two columns of fictitious date must be declared in the repository and used to define the guests of the date.

    but by using other methods I couldn't schedule option in the command prompt.

    but y at - it another way to get the guests with calndar selection without set dummy columns in the repository

    Thank you

    Try adding a column of similar date first and then edit the formula in the column

  • Using the query to get the group by rollup subtotal

    Hello

    Expected output is, for 'chris' each record must have subtotal row because it has different 'no' of the column values.

    For 'John' the subtotal came as planned because she didn't even.

    Could you please correct the query for "chris" below!

     select   
    case when nm is null then 'Total'  
         when no is null then 'Subtotal'  
         else nm  
    end nm,no,emplmt,profund,status,dt,sal,days,intrst,intrs1,intrs2  
    from   
    (  
        with t as     
            (select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('01/22/2014','mm/dd/yyyy') dt , 2456 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual    
            union all    
            select 'chris' nm , 20 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('01/03/2014','mm/dd/yyyy') dt , 1000 sal, 30 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual    
            union all    
            select 'chris' nm , 30 no ,'FT' Emplmt, 'PF' ProFund , 'NonReg' Status ,to_Date ('01/01/2014','mm/dd/yyyy') dt , 20 sal, -5 days , 1 intrst ,1 intrs1 ,1 intrs2 from dual    
           union all
           select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/02/2014','mm/dd/yyyy') dt , 1153 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual    
            union all    
            select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/16/2014','mm/dd/yyyy') dt , 1000 sal, 8 days , 40 intrst ,45 intrs1 ,50 intrs2 from dual    
    
    
           )    
        select nm,no,emplmt,profund,status,dt,sum(sal)sal,sum(days)days,sum(intrst)intrst,sum(intrs1)intrs1,sum(intrs2)intrs2  
        from t  
        GROUP BY ROLLUP (nm,no,emplmt,profund,status,dt)  
        order by nm,no,emplmt,profund,status,dt  
    )  
    where (no is not null and emplmt is not null and profund is not null and status is not null and dt is not null)  
    or (no is null and emplmt is null and profund is null and status is null and dt is null)  
    

    allows us to use grouping sets to produce just the totals you want.

    with t as

    (select "chris" nm1, 10 no1, "Pi" Emplmt, "PF" ProFund "Reg" Status, to_Date (January 22, 2014 "," mm/dd/yyyy") dt, 2456 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double)

    Union of all the

    Select No, the "chris" nm, 20 'ft' Emplmt, "PF" ProFund "Reg" Status, to_Date (3 January 2014 "," mm/dd/yyyy") dt, intrst 50, intrs1 55, 1000 sal, 30 days, 60 intrs2 of the double

    Union of all the

    Select "chris" nm, 30 no, "Pi" Emplmt, ProFund "PF", "NonReg" State, to_Date (January 1, 2014 "," mm/dd/yyyy") dt, 20 sal,-5 days, 1 intrst, 1 intrs1, 1 intrs2 of the double

    Union of all the

    Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (May 2, 2014 "," mm/dd/yyyy") dt, 1153 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double

    Union of all the

    Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (16 may 2014 "," mm/dd/yyyy") dt, 1000 sal, 8 days, intrst 40, 45 intrs1, 50 intrs2 of the double

    )

    SELECT

    CASE

    WHEN grouping (nm1) = 1

    THEN "Total".

    WHEN grouping (emplmt) = 1

    THEN "Subtotal".

    Of ANOTHER nm1

    END nm,

    CASE

    WHEN grouping (emplmt) = 1

    THEN NULL

    Of ANOTHER no1

    END no emplmt, profund, status, dt, sal SUM (sal), SUM (days) days, SUM (intrst) intrst, SUM (intrs1) intrs1, intrs2 SUM (intrs2)

    T

    GROUP BY Grouping SETS ((), (nm1, no1), (nm1, no1, emplmt, profund, status, dt))

    ORDER BY nm1, no1, emplmt, profund, status, dt

    NM               NO EM PR STATUS DT              SAL       DAYS     INTRST     INTRS1     INTRS2 chris            10 FT PF Reg    22.01.14       2456         10         50         55         60 Subtotal                                        2456         10         50         55         60chris            20 FT PF Reg    03.01.14       1000         30         50         55         60 Subtotal                                        1000         30         50         55         60chris            30 FT PF NonReg 01.01.14         20         -5          1          1          1 Subtotal                                          20         -5          1          1          1john             11 PT PF Reg    02.05.14       1153         10         50         55         60 john             11 PT PF Reg    16.05.14       1000          8         40         45         50Subtotal                                        2153         18         90        100        110 Total                                           5629         53        191        211        231 
    

Maybe you are looking for

  • I can't trun on my iphone

    Hello recntly I update can iphone 6s form ios to ios 10 afatre 9.3.2 1 day my iphone is turn turn on and I Caron turn on my iphone I do something with my iphone but I can't turn the phone and I can't go to the apple store locks in the my country has

  • Modes of reentry

    After reading http://digital.ni.com/public.nsf/websearch/98847B4E4C715E6D86256C59006B57CC?opendocument&Submitted&&... and discuss with other users of LV between that I still don't know what are the differences 'Share the clones between bodies' and 'C

  • maximum and minimum temperature

    Hello, I have read several posts on how to fix my problem, but unfortunately I have a problem with my VI. I want the maximum and minimum, this temperature on the front panel. I don't know if I have 2 while loops or only 1. The problem in the current

  • Roxio Creator 2012 has stopped working and comes up with an error in the Visual C++ Runtime library.

    Original title: what is the number of the download version 03/03/2011 for Visual C++ 2010SP1 x 64 Redistributable?  It is newer than the 10.0.30319(x64)? Roxio Creator 2012 stopped running and comes up with an error in the Visual C++ Runtime library.

  • NDK errors with external file

    I get no error in my code, but for some reason, I get errors in the file: 'unistd.h' located in '\target\qnx6\usr\include\ [ndkdir] '. I have 13 of them. Errors are: '' ssize_t' in the namespace "std" does not name a type', "std::dev_t has not been d