How to group by one column and concatinate records from another col

hi,
i want to fill a list-item in forms 6i with one cursor. i need a cursor / sql-function that fetch the data from the following table structur. it looks like this:
col1 col2
group1 01
group1 02
group2 03
group3 04
group2 05
group1 06
the resultset should look like this:
label value
group1 01.02.06
group2 03.05
group3 04
any ideas ?
thanks in advance.
greets Kevin

Try this
table X2
columns a and b
SELECT a
, LTRIM(MAX(SYS_CONNECT_BY_PATH(b,'.'))
KEEP (DENSE_RANK LAST ORDER BY curr),'.') AS concatenated
FROM ( SELECT a
, b
, ROW_NUMBER() OVER (PARTITION BY a ORDER BY b) AS curr
, ROW_NUMBER() OVER (PARTITION BY a ORDER BY b) -1 AS prev
FROM x2 )
GROUP BY a
CONNECT BY prev = PRIOR curr AND PRIOR a = a
START WITH curr = 1
Pls. Confirm if it works..

Similar Messages

  • How to insert some records in one table and some records in another table

    Interview question
    how insert records in two tables by using trigger
    CREATE or REPLACE TRIGGER Emp_Ins_Upd_Del_Trig
    BEFORE delete or insert or update on EMP
    FOR EACH ROW
    BEGIN
    if UPDATING then
    UPDATE emp2
    SET
    empno = :new.empno,
    ename = :new.ename
    --, job = :new.job
    --, mgr = :new.mgr
    --, hiredate = :new.hiredate
    , sal = :new.sal
    --, comm = :new.comm
    --, deptno = :new.deptno;
    sdate = :new.sdate,
    edate = :new.edate
    end if;
    if INSERTING then
    INSERT INTO emp2
    VALUES
    ( :new.empno
    , :new.ename
    --, :new.job
    --, :new.mgr
    --, :new.hiredate
    , :new.sal
    --, :new.comm
    --, :new.deptno
    new.sdate,
    new.edate);
    end if;
    if DELETING then
    DELETE FROM emp2
    WHERE empno = emp2.empno;
    end if;
    END;
    it is working fine but he wants to insert some specific litimit on one table and some specified limit of records in one ..
    In this senerio can i insert records by use count of records...
    please help me..

    Can you be more specific on the "Limit"
    Conditional insert can be used in this case.

  • How do I take one picture and combine it with another to make one?

    I'm new at this but I want to take one picture and then another picture and combine them making it look like it all taken at the same time. Any help?

    In Editor, go to the expert tab.
    Open picture B, the one you wish to select something from to add to another picture.
    Use one of the selection tools, e.g. selection brush, lasso tool, to select the object. You will see an outline ("marching ants") once the selection is complete
    Go to Edit menu>copy to copy the selection to the clipboard
    Open picture A, then go to Edit>paste
    Use the move tool to position object from picture B.
    In the layers palette you should see picture A as the background layer, and object B on a separate layer

  • How do I take one photo and add it onto another?

    I want to take the photo of a cheque, and add it to a photo so it looks like the person is holing  a large cheque (from shoes to waste sixed cheque)
    All assistance appreciated
    Kiwidreaming

    Easy Photoshop task:
    Open both check image and desired target image in Photoshop
    Switch to check image, trim out background stuff (possibly making sure the check is on its own layer, to ease background removal)
    Select all (control-A), copy (Control-C)
    Switch to target image
    Paste (Control-V) - This will paste the check image into a new layer of the document
    Re-size / transform (Control-T) - This is where you'll be able to tell if the check image was high enough resolution, and if you need another image
    Since the target document will have the check on a new layer, it gives you plenty of freedom for other corrections, adjustments, etc.
    There's a few other shortcuts to achieve the same effect, but this 'feels' the most straightforward.
    Cheers!

  • Iterative query to fetch from one column and insert/update in another colum

    i have a table with 5 columns as shown below
    Devicedetails
    userid ip deviceid makeby makedate
    123 100.00.20.11 | 00002011 xyz 10/11/2009
    456 102.03.21.12 | 02032112 def 11/12/2009
    678 null 02032112 def 11/12/2009
    896 111.22.33.44 02032112 def 11/12/2009
    in the above example i need to pick the value from deviceid - 022032112 and brake it in ot 02.03.21.12 (. after every tow digits) and prefix 1 (number one) at the end
    i am trying to write using cursor below not getting any idea
    1) I need to get the deviceid and subsctring it and update if the ip is there else insert

    SELECT REGEXP_REPLACE
              ('022032112',
               '([[:digit:]]{2})([[:digit:]]{2})([[:digit:]]{2})([[:digit:]]{2})([[:digit:]]{1})',
               '\1.\2.\3.\4.1\5'
              ) TEST
      FROM DUAL
    WHERE LENGTH ('022032112') = 9;o/p
    TEST
    02.20.32.11.12
    SELECT REGEXP_REPLACE
              ('02032112',
               '([[:digit:]]{2})([[:digit:]]{2})([[:digit:]]{2})([[:digit:]]{2})',
               '\1.\2.\3.1\4'
              ) TEST
      FROM DUAL
    WHERE LENGTH ('02032112') = 8;Edited by: DeepakDevarapalli on Nov 11, 2009 10:57 AM

  • How start an api from one JVM and stop it from another ?

    Hi all,
    I want just one instance of a program. Thus I need constroled if an instance of this tools already exists. But from an other JVM, how can I do this ?

    The question in your title doesn't match the one in the body of the post. I'm guessing you want to prevent multiple copies of your application from running concurrently on the same box.
    Create a ServerSocket on a specific port upon start up. If it's successful, you have effectively locked a Mutex for your application. If it's unsuccessful, you can make the assumption that another instance of your application is already running so you should exit.
    -S

  • How to make validation in Bean and select value from another table

    I want to know how to select data from table in backing bean according to primary key i have
    the problem is that
    i have a table Employee_Salary contains Employee ids and their salary
    Empoloyee_Salary table
         Employee_ID      Number
         Employee_salary Number
    And Another table Called Employees
    Employees table
         Employee_ID     Number
         IsManager Varchar2 its value is [*Yes or NO*]
    and other columns that i don't care about this table
    i have on a jsff page an <af:table> this table is editable this is the Empoloyee_Salary table
    *i want to check before save or after insert if this employee is Manager [from Employees tabke(yes or no)] the salary*
    cannot be less that 100
    i want to know how to make this how to select the value from employees table according to the id i have in the employee_salary table how to make this and make this validation
    i have to select IsManager from Employees Table to see if this manager or no
    i want to know how to make this in a bean
    i use jdeveloper 11g
    and my project is ADF Fusion project
    and the page that have the Emplpyee_Salary table is JSFF
    thanks in advance

    You might want to write this code in a validator on the entity object if it should apply from every screen.
    If you want to access view objects from a backing bean the basics are here: http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcservices.htm#sthref918

  • Show name from one table, and a sum from another table.

    Hi,
    For instance: I have 2 tables.
    1. Table1 has fields TenantID, TenantName,
    2. Table2 has fields AmmountCredit, AmmountDebit, TenantID.
    I need the following behavior.
    In the detailed section I want my report to show a list of TenantName, and a SUM of AmmountCredit minus Ammount Debit for that Tenant (which will come from Table2).
    How would I do this?  If a formula is involved, please provide an example because I'm fairly new to Crystal Reports.
    Thanks
    Aron

    Hi Aron,
    Please see if this helps:
    1) Go to the Database Expert > Add the two tables > Go to the Links tab > Join the two tables on the 'Tenant ID' field using an 'Inner Join' > Click OK
    2)  In the report, go to the Group Expert and create a group on the 'Tenant ID' field
    3) Place the 'Tenant Name' field on the Group Header 1
    4) Suppress the Details Section
    5) Create a formula with this code and place it on the Group Header 1:
    Sum({AmountCredit}, {TenantID}) - Sum({AmountDebit}, {TenantID})
    Here, {TenantID} is the Group field. So replace these fields with the right fields from your datasource.
    -Abhilash

  • How do I import all folders and saved messages from another email address?

    I'm using Mac OS X. Only my inbox messages have imported. I'm trying to import from my GoDaddy email account.

    ''re : Only my inbox messages have imported.''
    This sounds like you have created a POP mail account.
    Pop mail accounts can only get access and download from server Inbox to Thunderbrd mail account Inbox. This is not a Thunderbird quirk; it is how all POP mail accounts work.
    There is a workaround.
    In Thunderbird
    * Move all good emails from Inbox to other suitable folders.
    * Delete any emails you do not want.
    * Right click on Inbox and select : 'Compact'
    Now you have an empty Inbox which will make it easier to identify emails downloaded from different folders.
    * Log on to webmail account using a browser.
    * Move all emails from one of your folders into Inbox.
    * In Thunderbird select to 'Get Messages'
    * Thunderbird will download any emails not previously downloaded to the Inbox.
    * Create a suitable folder and move all those emails into it.
    Repeat this action to move emails in other folders into webmail Inbox and then download them.
    This will get emails from server folders into Thunderbird.
    From then onwards any new mail coming into server Inbox will get downloaded to Thunderbird mail account Inbox, so this workaround would only need to be done once.
    '''Note:'''
    Pop mail accounts usually download and delete off server, so if you do not want this to occur, check this first:
    Tools > Account Settings > Server Settings for the mail account
    OR
    right click on mail account in Flder Pane and select 'Settings'
    then 'Server Settings' for mail account.
    * Select 'Leave messages on server'
    If you want to auto delete some emails, you can select either ot both of these options:
    * For at most xx days
    * Until I delete them
    * Click on 'OK'
    If a POP mail account does not do what you want, you would need to see if your webmail account allows 'IMAP forwarding' and select that option.
    Then create a new IMAP mail account in Thunderbird.
    This would allow you to subscribe to see any folders on the server.
    IMAP accounts mean that you get a remote view of the server folders, so anything you do in Thunderbird will also occur on the server. eg: if you delete an email in Thunderbird it will delete off server as you are seeing one in the same folders.
    In both cases it is always advisable to periodically create a backup:
    Profile Folder location:
    * http://kb.mozillazine.org/Profile_folder_-_Thunderbird
    Backup info:
    * http://kb.mozillazine.org/Profile_backup
    Imap backup:
    * http://kb.mozillazine.org/IMAP_backup

  • How to run select query from one SID to fetch record from another SID?

    I have two SID, one is AAA and another is BBB and the connection name is A1 and B1 respectively. I want to run one select query from A1 connection to fetch record B1. Can anyone help me how I can connect from one SID to another SID?

    Hi 869357,
    You can also use the copy command. (Works with limited types)
    try:
    help copyRegards,
    Turloch

  • Create Sequences on one computer and render out from another

    Essentially what i'm trying to acheive is to use Premiere Pro (CS6) on my Mac to create sequences themselves but use a PC on the network to do the rendering work overnight.
    I create a number sequences, anywhere from a few minutes each that can be combined into hour plus long final videos.
    Is there a way to "package" a project onto a network drive where the PC can then see the project itself with the relevant source media?. I can move the project file and the source media singularly but I then need to manually relocate the media each time.
    The workflow would then be
    All source media originally loaded onto Mac
    Sequences within project made on the Mac
    When ready for rendering transfer to PC
    PC does work with Media Encoder, freeing up Mac for other tasks.
    Any help or suggestions would be most welcome!
    Thanks guys

    You will first have to have a consistent folder naming setup for both computers, so PPro may find the files
    You will need to have the project and all files in one place on the server, and then copy everything to the appropriate computer for work... PPro does NOT work on a network, only on a local hard drive
    So... edit on Mac, copy all to server... copy all to PC... render on PC... copy all back to server
    Some reading about networks...
    Win Server is NOT supported http://forums.adobe.com/thread/851602
    Not in a Network environment http://forums.adobe.com/thread/771151
    -a work around, of sorts http://forums.adobe.com/thread/957523
    -and not on a "domain" http://forums.adobe.com/thread/858977

  • Sync contacts from outlook on one computer and sync itunes from another?

    Can you sync your contacts say from your work computer but only sync the iTunes from you home computer? If so, do you have to use Itunes for both?
    Thanks

    Can't. Everytime I launch the iCloud Control Panel I get an error message saying "Repair the iCloud Control Panel to use iCloud with Outlook".  I've tried repairing it and I've uninstalled and reinstalled it and I still get the same error message.  Is this a known bug?  I'm running Windows Vista 64 bit.  Is there a known fix?

  • Pop-up menu in one column determines the value in another.  How?

    I'm setting up a company report, and one column has a pop-up menu.  I want the cell in another column to automatically enter a certain value depending on which option is selected in that pop-up menu.  How is that done?

    m,
    You can use any of the functions that look for a match in one column and pull data from another. As a class, they're called Lookup functions. I wouldn't plan on having your design survive an export to Excel, so you should consider who will be using your work and what platform they will have available.
    Jerry

  • Pages:  How can I sort one column of words and not have it affect the other columns?

    How can I sort one column of words and not have it affect the other columns?  I have opened the inspector to the edit columns and rows under Table.  It will sort the column, but then it changes the other colums as well.  I know that if I use Numbers, it will work, but I want to know how to do the same thing in Pages.

    Hi Peter,
    Numbers sorts full rows on values in selected column(s). The technique for sorting a single column is essentially the same as Jerry is describing for Pages tables—separate the (data in the) column to be sorted, sort it, return it to the table.
    In Numbers the actual column may be separated from the original table, sorted, then returned. In Pages, the data must be extracted, sorted, then pasted back in, overwriting the unsorted data (if it was left in the original table).
    iWork tables follow a database model in which each row is a Record, and each column holds a Field within the records.
    As evidenced by the current question (and several similar questions arising in the Numbers community) that model doesn't apply to the way some users, especially some who come in from the MS Excel world, use tables.
    With Excels model—islands of data on a single large table, the ability to sort one or a selected few columns of data makes sense. One 'island' may comprise only cells AA21:AH50. Sorting that small 'table' should be possible without disturbing the rest of rows 21-30, which are probably part of one or more other 'data islands' in the sea that is a MS Excel spreadsheet.
    In Numbers, each of those 'islands' would be a separate Table, and that Table would be sortable without disturbing other Tables in the document.
    Regards,
    Barry

  • How can I modify one column of current and next record depending of some criteria?

    Having DDL
    CREATE TABLE #ServiceChange(
    [ID] [int] identity(1,1),
    [SHCOMP] [char](2) NOT NULL,
    [SHCRTD] [numeric](8, 0) NOT NULL,
    [SHCUST] [numeric](7, 0) NOT NULL,
    [SHDESC] [char](35) NOT NULL,
    [SHTYPE] [char](1) NOT NULL,
    [SHAMT] [numeric](9, 2) NOT NULL,
    [CBLNAM] [char](30) NOT NULL,
    [GROUPID] [char](2) NULL
    And original and desire data in below link
    https://www.dropbox.com/sh/bpapxquaae9aa13/AADnan31ZASublDjN7sa2Vvza
    I would like to know how can I modify one column of current and next record depending of some criteria using SQL2012?
    The criteria is:
    Type should always flow F->T
    if current abs(amount)> next abs(amount) then groupid = 'PD'
    if current abs(amount)< next abs(amount) then groupid = 'PI'
    there is no case when those amounts will be equals
    where current(custid) = next(custid) and current(service) = next(service) and groupid is null
    Any help will be really apreciated.
    Thank you

    I tried that and got this error
    'LAG' is not a recognized built-in function name.
    You said you were using SQL 2012, but apparently you are not. The LAG function was added in SQL 2012. This solution works on SQL 2005 and SQL 2008:
    ; WITH numbering AS (
       SELECT groupid,
              rowno = row_number()  OVER (PARTITION BY custid, service ORDER BY date, id)
       FROM   #ServiceChange
    ), CTE AS (
       SELECT a.groupid,
              CASE WHEN abs(a.amount) < abs(b.amount) THEN 'PD'
                   WHEN abs(a.amount) > abs(b.amount) THEN 'PI'
              END AS newgroupid
       FROM  numbering a
       JOIN  numbering b ON b.custid  = a.custid
                        AND b.service = a.service
                        AND b.rowno   = a.rowno - 1
    UPDATE CTE
    SET   groupid = newgroupid
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for

  • Netflix won't open in safari on mac desktop

    can anyone tell me how to get netflix to work on my desktop mac through safari.

  • UseCase--Displaying a Editable table on a form

    Frnds, Help me in doing my usecase... Scenario@ Have to display an table on a form, such that selection of each row should navigate to another page(where we can edit that row content and updating to database)..... Done, creating an view object and dr

  • How do I get Elements 12 to run?

    I just installed the full version of Elements 12 and I can't get it to run.  It keeps wanting me to start the trial version.  I installed the full version and I know that it is installed.  I tried inserting the disc again, but then it just offered to

  • MacBook shuts down on battery power at high cpu usage

    I have a black MacBook core 2 duo (MacBook 2,1) that has always worked perfectly, but about 2 weeks ago it started to shut down without any notification. When I am doing CPU intensive tasks I can hear a click and immediately after the computer turns

  • File associations for plsql

    Hi, I am new to JDeveloper and I'm using it mainly for plsql development. We have a standard file naming convention for packages (.pks for specs and .pkb for bodies). When I open those files in JDeveloper the files are not recognized as being plsql p