How to split values of column in a table

i have a scenario like
bank year amount
aaaa 20091 1000
bbb 20091 100
ccc 20091 10
ddd 200812 100
aaa 200812 98788
bbb 200812 777
ccc 200812 666
i need to get like
bank 20091 200812
aaa 1000 100
bbb 100 777
ccc 10 666
like that...years of individual banks should be displayed as a columns and below that i should get respective amounts....is it possible in sql?

This type of question has been asked and answered countless times.
Have you tried searching the forum? Is Google broken for you?
Try searching for: "rowss to columns", "pivot table", "crosstab",...

Similar Messages

  • How to split list of columns into 2 tables in SSIS 2012?

    Hi,
    I have 200 columns in Source. Now i want to split these columns, few into Destination A and few more columns into
    Destination B. Multi cast i tried to use, but it coping all the columns . Any help would be appreciated. Thanks in Advance.
    Lets assume  i have columns  A,B,C,D,E..
    i want to move Columns A,B,D into destination A and 
    columns A,C,D,E INTO Destination B. please help me to implement this logic?

    Hi vasu_479,
    Based on your description, you want to split columns in source table into two destination tables.
    After testing the scenario in my environment, we can use Multicast to achieve your requirement. Just as you said, the Multicast would return all columns. But we can use the method below to achieve the goal:
    If the destination tables are existing tables, we can just map column A, B and D as Input Columns to the corresponding Destination Columns in the Mapping tab for destination A. Then map column A, C, D and E in destination B.
    If the destination tables are created in the Destination component, we can modify the create table query to directly create A, B and D for destination table A, create A, C, D and E for destination table B. Then there columns would be automatically mapped
    in the Mappings pane.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How we can replace the column in Core Table plz see this msg

    Hi,
    How we can replace the column in Core Table plz see this msg
    Req:
    when i push the Insert button the data inserted into the Table
    like
    Cols Values
    FOCD      CUFZ14
    PRDCD FU6
    Month 082008
    AgencyCD AG02
    PLAN 123
    This is FO_Plan Table....
    Requirement:
    i need at table show to replace the Prd_CD to Prd_Desc while inserting the above Row....
    There is no Prd_Desc in FO Plan Table....
    Prd_desc comes from Product Table.
    did u get my point...
    how to solve.
    Thanks
    Ram
    Edited by: Ram Vungarala on Sep 24, 2008 9:09 AM
    Edited by: Ram Vungarala on Sep 24, 2008 9:15 AM

    Hi,
    I'm not sure if I understood what are you trying to do. But you can modify your table in a backing bean code. JSF page code for a table:
    <af:table id="product_search_results_tbl" binding="#{backingBean.boundTable}" ... />
    And a backing bean code:
    import oracle.adf.view.faces.component.core.data.CoreTable;
    public class YourBackingBean {
        private CoreTable boundTable;
        public void setBoundTable(CoreTable boundTable) {
            this.boundTable = boundTable;
        public CoreTable getBoundTable() {
            return boundTable;
       public String insertButtonAction() {
          // Bind your button action to this method and modify here your bound table
         return null;
    {code}
    Look for column modification methods in a CoreTable class documentation.
    Marius                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to provide Link to Column in  the Table

    Hi
    please let me know how to provide link to one column in the table.
    i have two views
    in one view i will dispaly emp id and emp dept in a table
    i have to provide link to the emp id column table
    when i click emp id column then it will fire other view and display remaining details of emp.
    so please let me know how to provide link to column in the table.
    Solution is urgent
    regards
    mmukesh

    Hi Mukesh,
       You can insert LinkToAction column in table.you can have two cattributes in Valuenode one is of type boolean and other is of type string(empno)
    you can create eventhander in that you can fire plug to seconf view where you can displays the emp details
    With Regards
    Naidu

  • How to split values across the columns

    Hi,
    I have a dataset as follow
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ROWSET>
    - <ROW>
    <fm_firmnum>0054</fm_firmnum>
    </ROW>
    - <ROW>
    <fm_firmnum>0053</fm_firmnum>
    </ROW>
    - <ROW>
    <fm_firmnum>0055</fm_firmnum>
    </ROW>
    </ROWSET>
    Now, I have created a rtf template and would like to make the table look like the following under this circumstances
    - If the rows (row count, but I dont' know how to do row count in BIP) mod 2 = 1 then put it in the left column of the table
    - If the rows mod 2 = 0 then put it in the right column of the table.
    Hence the table should look like this as the outcome
    fm_firmnum | fm_firmnum
    0054 | 0053
    0055 |
    Any idea on how to do it? Many thx
    Rgds,
    Raymond

    Hi Raymond,
    The rowcount can be known using position() syntax:
    so your logic can be achieved using the following way:
    Col1 Col2
    <?if:position() mod 2 =1?><fm_firmnum><?end if?> <?if:position() mod 2 =0?><fm_firmnum><?end if?>
    Keep this on one form field <?if:position() mod 2 =1?><fm_firmnum><?end if?>
    and keep this in 2nd form field <?if:position() mod 2 =0?><fm_firmnum><?end if?>
    Best Regards,
    Mahi
    Edited by: BIP Learner on Jul 19, 2009 10:44 AM

  • How to Split the Date Column in OBIEE

    Hi,
    We have date column name :To_Date and format is MM/DD/YY HH:MM:SS .
    How do split the date into YEARS,MONTH,DAY as new columns.
    kindly help on this.
    Regards.,
    CHR
    Edited by: 867932 on Nov 23, 2011 10:18 PM

    Hi User,
    All 3 functions can be written in rpd too.In BMM layer, duplicate the date column ->Goto Column Mapping tab-> Expression builder ->Select Functions-> Calendar Date/Time Functions-> Select DayofMOnth function. Your logical column's formula will look like,
    DayofMonth(YourDateColumn)
    Rgds,
    Dpka

  • How to retrive value from column of type number

    Hi,
    I have a site column 'Sample' which is of type Number. Number of decimal places for the column is specified as 0.
    Consider the Sample column has a value '2'.
    When I retrieve the properties for Sample column, the value is displayed as 2.0000000
    I am retrieving the listitem properties using SPListItem.Properties in ItemCheckedin event.
    How to get value without the decimal places?
    Thanks in advance,
    dhijit

    Hi.
    You can cast this value as int.
    int myVal = (int)myItem["myField"];
    if cast crashes, try to use int.TryParse or Convert.ToInt32 Mehods
    Regards,
    Bubu
    http://zsvipullo.blogspot.it
    Please mark my answer if it helped you, I would greatly appreciate it.

  • How to store values in column

    Hi all,
    In below table structure , for the 3rd row , how could store values?
    Like 2- other lanes
    3- other lanes
    9-other lanes
    or is there any other way ?
    Code       Lane
    0      Data with lanes combined
    1      Outside (rightmost) lane
    2-9      Other lanes

    user10641405 wrote:
    Hi ,
    I'm populating lookup table for the table called 'lane of travel'
    I have pasted the table structure wit the data in my 1st post.Not really. What is the data type of the 'code' column?
    In that tablel , 3rd row for the column 'code' it says 2-9.So you have a row inserted, with the value of '2-9' in the CODE column?
    To insert values into that row , either i have to store value as '2-9' - 'other lanes'
    or 2 - other lanes
    9 - other lanes ?I really don't understand your issue.
    insert into MYTABLE (code, lane) values ('2-9','other lanes');Maybe it would help if you showed us (copy and paste an actual sqlplus session) what you have done, what you got, and what you want.

  • How to split Value in a field while importing

    Hi,
    I want to split Value in Field and map it 2 target Field.
    Suppose Street field having values with House number and street name ,need to split  at House Number and street name and map it 2 fields
    EX : 1123 Dhuram Ave:    Need to split 1123 and Dhuram Ave ,need to map it to 2 target field.
    Here I don't have any delimeter in the field Value.
    Please help on this.
    Thanks,
    Madhu
    Edited by: Madhusudhan Honnappa on Nov 30, 2010 5:19 PM

    Hello.  I'm assuming this is a custom import as typically, standard extractors would have the house number and street already seperated into unique fields.  Here is a quick routine I tried out that would split the field.  Only thing I would add is that if writing this from scratch you would want to check that the first character is numeric and also that all characters before the space are numeric.  This routine assumes that the field will be like xx yy  where xx = house number and yy is the street.  Mainly, it would assume anything before the first space is the house number and anything after is the street.
    YLEN = STRLEN( YYINPUT ).
    YTIMES = 0.
    DO YLEN TIMES.
       IF YYINPUT+YTIMES(1) = SPACE.
          YOFFSET = YTIMES.
          "House Number" = YYINPUT(YOFFSET).
          YOFFSET = YTIMES + 1.
          "Street" = YYINPUT+YOFFSET.
          EXIT.
       ENDIF.
       YTIMES = YTIMES + 1.
    ENDDO.
    I'm sure there are many ways to go about this and may be some standard FMs you can call.  I just like trying to write it first to get a better understanding.  Not sure if this quick example will give you exactly what you need, but hopefully will at least give you a place to start.
    Thanks

  • Splitting and merging columns in a table?

    Hi I have asked this question before. Does any one know how to split a column into two in a table. Know this can be done in a Word Doc. I know the merge works but can't seem to find the split.

    The merge is simple if you do not think about it as in word:))
    The merge can be done using scripting: just concatenate the values of the fields into one variable, fill in the value to the first column, change its width (to the width of the previous 4 cols) and hide te remaining/ blank cols.
    Have fun, Otto

  • How to populate the master column in a table

    Hi Experts,
    I am trying to implement a hierarchy structure in a table. For that I have inserted a master column of TreeByNestingTableColumn type. The value which are getting displayed in a table are hard coded by me, but I am not able to understand how should I populate the values so that when the table initially appears, it should contain some data (which I hard code) and when I click the master column, it should expand and display value according the master column selected(which I again hard code).
    Please help me in achieving it.
    Regards
    Arjun

    Hi,
    Go throgh the tutorial "Creating a Tree Structure in a Table" in the blow link.
    Web Dynpro Java Tutorials and Samples NW 2004 [original link is broken]
    In these example only the souce of data changes as per your requriement. In the examples they are reading data from java class.
    1. First you need to create a value node with (Parent Id, Boolean Type: isLeaf, Expanded, ChildernLoaded), attributes.
    2. Then you have to create one recursive node under that Value node by selecting that node as reference.
    3. As given in the example create one method called addChildern(Node, ParentId).
    4. Now in the wdDoInit method call this method by passing the Value node and "ROOT" as parent Ids
    5. In addChildern method if parentId is ''ROOT" then populate all the root elements in the parent node.
    6. Now root elements will be populated.
    7. When user clicks on any of the root element then invoke the action loadChildern(this should be binded to Master column) and pass recursive node of that parent element and the parenId (as given in the exmaple).
    8. Based on this parentId now populate the chids in addChildern method.
    See this thread: Helpful:
    Re: Tree implementation in webdynpro project
    Regards,
    Charan
    Regards,
    Charan

  • How to populate the organization_code column in ST table for legacy system

    Hi, dear all,
    Now I use the stage table to load the setup&transaction collection data from a non-EBS legacy system to ASCP system.
    My question is: how to populate the organization_code column in the stage table?If the source system is EBS system, maybe it's an inventory organization code. But for the non-EBS system, which value is need fo this field? keep it as blank? or assign some value for it?
    Thanks
    Edited by: 852938 on 2011-5-4 下午10:24

    I find some words in the implementation guide, it says:"To collect data from your non-Oracle ERP systems or your trading partners' systems,you model each non-Oracle ERP system or trading partner as an Oracle Applications organization and store their setup and transaction data there".
    But I can't find where to model the application organization for the legacy system.
    anyone can give some clues? Thanks in advance.

  • How to update the COST column using another table's column

    Dear All,
    I have table:
    table parts: pno, pname, qoh, price, olevel
    table orders: ono, cno, eno, received, shipped
    table odetails: ono, pno, qty
    view:orders_view: ono, cno, eno, received, shipped,sum(qty*price)order_costview:odetails_view: ono, pno, qty, (qty*price)cost
    after I update the price in parts, I need to update COST and ORDER_COST too. The orders_view does not have pno, qty, and price, the odetails_view does not have price, how can I update the COST and ORDER_COST. Please help and Thanks in advance!!!
    I wrote the update the price in parts:
    create or replace procedure change_price(ppno in parts.pno%type, pprice in parts.price%type) as
    begin
        update parts
        set price = pprice
        where pno = ppno;
    end;
    show errorsthis procedure works fine.
    I wrote the trigger:
    create or replace trigger update_orders_v
    after update of price on parts
    for each row
    begin
        update orders_view
        set order_cost = sum(parts.(:new.price)*parts.qty)
        where parts.pno = :new.pno;
    end;
    show errorsIt gives me:Errors for TRIGGER UPDATE_ORDERS_V:
    LINE/COL ERROR
    3/5 PL/SQL SQL Statement ignored
    4/22 PL/SQL ORA-00934: group function is not allowed hereplease help!

    You could add the columns to the tables and then you would need a trigger to update those columns. However, you could just as easily select the price * qty to get the cost, without creating an additional column or trigger. I have no idea what you might want to do with a global temporary table. I think you need to explain what your purpose is, before any of us can suggest the best method. Since I have already demonstrated an update with a view, I will demonstrate an update with the cost column added to the odetails table and a trigger as you asked about. Notice that you will need triggers on both tables, the one that has qty and the one that has price.
    scott@ORA92> create table parts
      2    (pno    number(5) not null primary key,
      3       pname  varchar2(30),
      4       qoh    integer check(qoh >= 0),
      5       price  number(6,2) check(price >= 0.0),
      6       olevel integer)
      7  /
    Table created.
    scott@ORA92> create table odetails
      2    (ono    number(5),
      3       pno    number(5) references parts,
      4       qty    integer check(qty > 0),
      5       cost   number,
      6       primary key (ono,pno))
      7  /
    Table created.
    scott@ORA92> create or replace procedure change_price
      2    (ppno   in parts.pno%type,
      3       pprice in parts.price%type)
      4  as
      5  begin
      6    update parts
      7    set    price = pprice
      8    where  pno = ppno;
      9  end;
    10  /
    Procedure created.
    scott@ORA92> create or replace trigger update_cost1
      2    after insert or update of price on parts
      3    for each row
      4  begin
      5    update odetails
      6    set    cost = qty * :new.price
      7    where  pno = :new.pno;
      8  end update_cost1;
      9  /
    Trigger created.
    scott@ORA92> show errors
    No errors.
    scott@ORA92> create or replace trigger update_cost2
      2    before insert or update of qty on odetails
      3    for each row
      4  declare
      5    v_price parts.price%type;
      6  begin
      7    select price
      8    into   v_price
      9    from   parts
    10    where  pno = :new.pno;
    11    --
    12    :new.cost := :new.qty * v_price;
    13  end update_cost2;
    14  /
    Trigger created.
    scott@ORA92> show errors
    No errors.
    scott@ORA92> insert into parts values (1, 'name1', 1, 10, 1)
      2  /
    1 row created.
    scott@ORA92> insert into odetails values (1, 1, 22, null)
      2  /
    1 row created.
    scott@ORA92> -- starting data:
    scott@ORA92> select * from parts
      2  /
           PNO PNAME                                 QOH      PRICE     OLEVEL
             1 name1                                   1         10          1
    scott@ORA92> select * from odetails
      2  /
           ONO        PNO        QTY       COST
             1          1         22        220
    scott@ORA92> -- update:
    scott@ORA92> execute change_price (1, 11)
    PL/SQL procedure successfully completed.
    scott@ORA92> -- results:
    scott@ORA92> select * from parts
      2  /
           PNO PNAME                                 QOH      PRICE     OLEVEL
             1 name1                                   1         11          1
    scott@ORA92> select * from odetails
      2  /
           ONO        PNO        QTY       COST
             1          1         22        242
    scott@ORA92> -- select works without extra cost column or trigger:
    scott@ORA92> select o.ono, o.pno, o.qty, (o.qty * p.price) as cost
      2  from   odetails o, parts p
      3  where  o.pno = p.pno
      4  /
           ONO        PNO        QTY       COST
             1          1         22        242
    scott@ORA92>

  • How to extend No. of columns for PIVOT table in BI Publisher Desktop

    Hello Everyone,
      I am using the Oracle BI Publisher Desktop to design the TEMPLATE for Oracle Reports.
    I need to create the PIVOT table .In my PIVOT table I need to display 9 columns but when I tried to create PIVOT table by dragging 9 columns only first 4 columns are displaying in report.
    Can anyone suggest me how can I increase the number of columns in PIVOT table?
    Thank You.
    Regards,
    Guru.

    hi jim
    if you carefully look inside the form field's you will find the logic of sort . if you remove that you will get the data without any sorting order.
    else send me your template and xml to my email id i can look into that .
    email : [email protected]

  • How to get the primarykey columns of the table in SAP BI Java SDK

    Hi, I'm new to sap BI Java SDK. I'm not getting how to get the primarykey columns, using BI JDBC Connector (for relational data sources). If anybody knows, please let me know. its very very urgent task to be done in my project. In the below following code.... I have written a code to connect to the database through resource bundle, reading table names, once user select table name, i need to show the primary key columns of that table to the user. here i'm not getting how to get the primary key columns . Please send me the code if there is any method to find out the primarykey columns or a logic to get them. I will be greatful to you.... if you can do this favour.
    Please check out the following code ........
    ManagedConnectionFactory mcf;
    IConnectionFactory cf;
    IConnectionSpec cs;
    mcf = new JdbcManagedConnectionFactory();
    cf = (IConnectionFactory) mcf.createConnectionFactory();
    cs = cf.getConnectionSpec();
    ResourceBundle rbLocal = ResourceBundle.getBundle( "xxxx");
    Enumeration propnames = rbLocal.getKeys();
    while (propnames.hasMoreElements())
    String key = (String) propnames.nextElement(); //out.print(key); //out.println("="rbLocal.getString(key)"");
    cs.setPropertyValue(key, rbLocal.getString(key));
    // Establishing the connection. // The IBIRelational interface provides an entrypoint to access // metadata and execute queries.
    IBIConnection connection = (IBIConnection) cf.getConnectionEx(cs); I
    BIRelational rel = connection.getRelational();
    IBIQuery query = rel.createQuery();
    String sqlStatement = "SELECT * FROM " + "BICQPERSON where type='pk'"; ResultSet rs = IBIDataSet dataset = query.execute();
    Thanks SreeKanth

    Hi,
    looks like you are on Infomation Builders, correct? If yes through which adapter and to what DB are you connecting?? in an R3/BW system you can do the folowing:
    "(ABAP)
    SELECT DISTINCT FIELDNAME
    FROM DD03L
    WHERE TABNAME = '/BIC/QPERSON'
      AND AS4LOCAL = 'A'
      AND KEYFLAG = 'X'
    ORDER BY 1
    Another option is goto directly to the RDBMS; in this case let me which one are you using
    hope this helps...
    Olivier.
    Message was edited by:
            Olivier Cora

Maybe you are looking for

  • Internal number range

    Hi All, I have defined the internal number ranges and assigned to vendor account group but when i create a vendor master  record the system allocating number randomly instead of serielly why this is happened ? Regards, Rajesh

  • With out source system creation we have transported all the flow

    Hi all, With out source system creation in Quality we have transported all the data flow now is there any option to map the source system to transported flow. Regards Kiran Kumar

  • Loading swf into container

    I have created a movie that loads several swfs through an empty container. I have tried changing file paths numerous times and I can't get the movies to play correctly. Actually, they did on our local testing server, but after uploading to the client

  • Could not find PPPoe server

    I connect to internet wireless and have no problems except I continue to get a popup saying "could not find PPPoe server". I just say ok but it continues to come up every so often. How can I stop it from continually coming up? This just started recen

  • JFrame.requestFocus() doesn't work on Mac os X

    Does anybody could propose a workaround? I have several JFrame in my application and I have to be able to switch the "focus" dynamically from a JFrame to another. Thanks for you help.