Issue in populating values in a column based on values in other columns

I have a situation as below:
Src        Tar             New tar
AC001  TAC001  
AC002  TAC001      AC002
AC003  TAC001
AC011  TAC011
AC012  TAC011      AC012
AC021  TCA021
AC022  TCA021
Now, wherw I have New target as AC002, I need to copy the same value to TAC001 which is the 1st and 3rd row. Similarly, I need to copy AC012 to 4th record. And my last 2 rows will be null as I do not have any values for TCA021..Any thoughts on this would be apprecated..
Thanks in advance..

Hi
almost all is said so i tip you How to Fish (with Pictures) - wikiHow because it is good asset for future when you are hungry
Read also http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions004.htm#SQLRF06174
"Analytic functions compute an aggregate value based on a group of rows. They differ from aggregate functions in that they return multiple rows for each group. The group of rows is called a window and is defined by the analytic_clause. For each row, a sliding window of rows is defined. The window determines the range of rows used to perform the calculations for the current row. Window sizes can be based on either a physical number of rows or a logical interval such as time.
Analytic functions are the last set of operations performed in a query except for the final ORDER BY clause. All joins and all WHERE, GROUP BY, andHAVING clauses are completed before the analytic functions are processed. Therefore, analytic functions can appear only in the select list or ORDERBY clause.
Analytic functions are commonly used to compute cumulative, moving, centered, and reporting aggregates."

Similar Messages

  • Hide column based on condition on other column in table

    hi,
    am using BIP 10.1.3.2 to generate reports.In the template i need to hide one column based on condition on other.am using SQL query as my data source type.can anybody help me ?

    Use <?if:?> condition in the RTF, but its mainly for the rows not column. You can work around this by handeling in backend. Or take two separate tables, one with the column which you want to hide and another table without that column and before calling that table use IF condition.
    Regards,
    Amit D
    Persistent Systems Ltd.

  • Column check constraint cannot reference other columns  !????

    Hello,
    why it don't work?
    I have read that Check Constraint must work with other columns. What is the Problem here (KK_ID)?
    DROP TABLE Pat CASCADE CONSTRAINTS;
    CREATE TABLE Pat
    PAT_ID           NUMBER(12) NOT NULL
              CONSTRAINT pat_id PRIMARY KEY initially immediate,
    NAME           VARCHAR2(50)NOT NULL initially immediate,
    date_b          DATE NOT NULL initially immediate,
    PRIVAT_KNZ VARCHAR2(20)
              CONSTRAINT PRIVAT_KNZ_ CHECK (UPPER(PRIVAT_KNZ) in ('Y','N')) initially deferred,
    KK_ID           NUMBER(10)
              CONSTRAINT KK_ID CHECK      ((UPPER(PRIVAT_KNZ) in ('N')) AND KK_ID is NOT NULL) OR ((UPPER(PRIVAT_KNZ) in ('Y')),
              CONSTRAINT REF_KEY_KK FOREIGN KEY (KK_ID)
              REFERENCES Tab2 (KK_ID) initially deferred          
    The field KK_ID must became a value if PRIVAT_KNZ has a 'N'. If PRIVAT_KNZ has a value 'Y' then can KK_ID have a NULL or a value.
    ERROR__________________________________________________________________
    DROP TABLE Patient CASCADE CONSTRAINTS
    ERROR at line 1:
    ORA-00942: table or view does not exist
              CONSTRAINT KK_ID CHECK      ((UPPER(PRIVAT_KNZ) in ('N')) AND KK_ID is NOT NULL) OR ((UPPER(PRIVAT_KNZ) in ('J')),
    ERROR at line 12:
    ORA-02438: Column check constraint cannot reference other columns
    Thank you in advance!!!!
    Andrej

    Thank You very much!
    It works great!
    But i don't understand why i must put coma, after
    KK_ID                NUMBER(10) NUll REFERENCES KRANKENKASSE ,
    And then follows the contstraint? How can i see, that constraint KK_ID belongs to column KK_ID?
    How can i make,than the constrain belongs to definition of Columns KK_ID?
    Thank you in advance!
    DROP TABLE Krankenkasse CASCADE CONSTRAINTS;
    CREATE TABLE Krankenkasse
    KK_ID                NUMBER(10)
                        CONSTRAINT KK_id_PR PRIMARY KEY,
    BEZEICHNUNG          VARCHAR2(20)
    INSERT INTO Krankenkasse VALUES(1, 'AOK');
    INSERT INTO Krankenkasse VALUES(2, 'Techniker');
    INSERT INTO Krankenkasse VALUES(3, 'Barmer');
    DROP TABLE Patient CASCADE CONSTRAINTS;
    CREATE TABLE Patient
    PATIENTEN_ID           NUMBER(12) NOT NULL
         CONSTRAINT pat_id PRIMARY KEY initially immediate,
    NACHNAME           VARCHAR2(50)NOT NULL initially immediate,
    VORNAME           VARCHAR2(20)NOT NULL initially immediate,
    ADRESSE           VARCHAR2(100)Null,
    GEB_DATUM           DATE NOT NULL initially immediate,
    PRIVAT_KNZ           VARCHAR2(20)
                   CONSTRAINT PRIVAT_KNZ CHECK (UPPER(PRIVAT_KNZ) in ('J','N'))
                   initially deferred,
    KK_ID                NUMBER(10) NUll REFERENCES KRANKENKASSE,
                   CONSTRAINT KK_ID CHECK
                   ((Upper(PRIVAT_KNZ) in ('N') AND KK_ID is NOT Null) OR (UPPER(PRIVAT_KNZ)in ('J')))
    INSERT INTO PATIENT VALUES(1,'Schmidt','Bernd','Adresse1', TO_DATE('01101965', 'DDMMRRRR'),'N',1);
    INSERT INTO PATIENT VALUES(2,'Mueller','Heiko','Adresse2', TO_DATE('15061955', 'DDMMRRRR'),'N',1);
    INSERT INTO PATIENT VALUES(3,'Becker','Josef','Adresse3', TO_DATE('03101947', 'DDMMRRRR'),'J',2);
    INSERT INTO PATIENT VALUES(4,'Winter','Paul','Adresse4', TO_DATE('01051933', 'DDMMRRRR'),'J',Null);
    INSERT INTO PATIENT VALUES(5,'Winter','Paul','Adresse4', TO_DATE('01051933', 'DDMMRRRR'),'N',Null);
    commit;
    __________________________________________________________________________

  • Insert value into a column based on value of another column

    Hi,
    I am trying to insert a value into a record based on a column in
    the record, using a trigger. The complication arises because
    the new value is selected from the same table. For example:
    SELECT COL1, COL2, COL3, COL4 from TABLE1
    I want to set COL2 and COL3 based on the value of COL4. And to
    get the value of COL2 and COL3, I will go back to TABLE1 and set
    the condition to TABLE1.COL1 = :NEW.COL4
    I cannot seem to execute the trigger as I get the message "ORA-
    04091: table SYSTEM.TABLE1 is mutating, trigger/function may not
    see it" everytime.
    Is this the correct way to achieve what I wanted? Or is there
    another way?
    Appreciate your feedback. Thank you in advance.

    Hi,
    I am trying to insert a value into a record based on a column in
    the record, using a trigger. The complication arises because
    the new value is selected from the same table. For example:
    SELECT COL1, COL2, COL3, COL4 from TABLE1
    I want to set COL2 and COL3 based on the value of COL4. And to
    get the value of COL2 and COL3, I will go back to TABLE1 and set
    the condition to TABLE1.COL1 = :NEW.COL4
    I cannot seem to execute the trigger as I get the message "ORA-
    04091: table SYSTEM.TABLE1 is mutating, trigger/function may not
    see it" everytime.
    Is this the correct way to achieve what I wanted? Or is there
    another way?
    Appreciate your feedback. Thank you in advance. I'm not sure what you mean when you insert a value into a
    record, but if you are setting a value in a column of the same
    record using a trigger, then it's easy.
    :new.COL2 := ....:new.COL4...
    :new.COL3 := ....:new.COL4...
    The trigger must be 'INSERT or UPDATE' and 'FOR EACH RECORD'.
    If you are setting a different record in the same table, the
    solution is much more difficult.

  • Custom table column based on value scale

    I want to custom table column based on the vaules.
    I understood I need to to /1000000 in the column definition and custom ###,###,###M.
    But sometimes it can be Kilos and sometimes Billions.
    I don't want to display 0.02M or 200000M.
    How can I define conditional custom according to the current value?

    Try doing what I said here and see if it works for you...
    Re: Represent numbers in thousands

  • Deriving 1 Value from 2 Fields Based on Values in Fields

    I have a query that needs to return 1 of my values based on the values from 2 fields from 2 tables. However, the value should only be returned in 1 field and one of the fields should be evaluated first. If this first evaluated field has a certain value ('Y') then the other field is ignored.
    To be more clear, per the normal query below, what I want is to somehow, if possible, combine the case t2.el_contr and case t1.contr_type statements so that one field, say: mbr_contr_type_desc returns a value.
    So that if the value of t2.el_contr is 'Y' then 'SUB CHILD' is returned. It is important that this field should be evaluated first (If the value of it is 'Y' then the other field evaluation can be ignored). If this is not 'Y', then t1.contr_type should be evaluated and the values as listed below also returned to mbr_contr_type_desc.
    I know the following isn't correct, but it might better illustrate what I'm trying to do (the normal query is below this)
    case t2.el_contr
    when 'Y' then 'SUB CHILD'
    case t1.contr_type
    when 'A' then '1 PARTY MALE SUB'
    when 'B' then '1 PARTY FEMALE SUB'
    when 'C' then '2 PARTY MALE SUB'
    when 'D' then '2 PARTY FEMALE SUB'
    when 'F' then 'FAMILY MALE SUB'
    when 'G' then 'FAMILY FEMALE SUB'
    end as mbr_contr_type_desc
    In an Access query I would do the following in a column:
    iif([el_contr]='Y',"SUB CHILD',SWITCH([contr_type]="A","1 PARTY MALE SUB",[contr_type]="B" etc.))
    *NORMAL QUERY*
    select t1.ssn
    t1.type,
    t1.grp_id,
    t1.contr_type,
    t2.el_contr,
    case t2.el_contr
    when 'Y' then 'SUB CHILD'
    end as mbr_contr_type_desc_2,
    case t1.contr_type
    when 'A' then '1 PARTY MALE SUB'
    when 'B' then '1 PARTY FEMALE SUB'
    when 'C' then '2 PARTY MALE SUB'
    when 'D' then '2 PARTY FEMALE SUB'
    when 'F' then 'FAMILY MALE SUB'
    when 'G' then 'FAMILY FEMALE SUB'
    end as mbr_contr_type_desc_1
    from member_elig t1
    inner join grp_master t2 on
    t1.grp_id = t2.grp_id

    Perfect!
    Thanks, didn't know that existed. Still learning my way around pl/sql..
    One other (unrelated) question..when i hit the CTRL+LEFT ARROW* button in my SQL window, it will not tab back. This is really annoying! I have looked through PREFERENCES-EDITOR and can't seem to find any setting that will allow this. Do you know of any way to change this so I can tab backwards/fowards through code in the SQL window?
    Thanks for any suggestions!
    *Or CTRL+RIGHT ARROW for that matter..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Populate f4 values of a field based on value of other field

    Hi,
    I have created select options using WDR_SELECT_OPTIONS.For one of the fields ,f4 values should be based on value of another field in the screen.
    How will i achceive this requirement.
    I got a link about the same but that is not using WDR_SELECT_OPTIONS
    http://www.sdn.sap.com/irj/scn/logon?redirect=/irj/scn/wiki?path=/display/WDABAP/Using%20Search%20help%20attachments%20for%20WebDynpro%20ABAP
    I got another link
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/606288d6-04c6-2c10-b5ae-a240304c88ea?quicklink=index&overridelayout=true
    which I am going to try
    Thanks
    Bala Duvvuri
    Edited by: Bala Duvvuri on Jun 22, 2011 6:49 AM

    Hi,
    Using OVS you can achieve this.,  In OVS Event Handler read the value based on which you  want to display F4 for other field and populate the values based on the first field.
    this link is fine., go through this: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/606288d6-04c6-2c10-b5ae-a240304c88ea?quicklink=index&overridelayout=true
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • Sharepoint 2013, Document Library: Sharepoint is changing data in a single line of text column to ISO8601 after modifying other columns

    Hello there,
    basically, as the title says: We have a Document Library on a Sharepoint 2013. Attached to every document are multiple columns, the type for every column is 'Single line of text'.
    One column is called 'billing date' and has suitable data in it, e.g. 01.01.2015, 26.02.2015, 29.03.2015 an so on.
    Sometimes when someone is editing an other column of the same document the data in 'billing date' changes from 01.01.2015 to 2015-01-01T00:00:00Z for that document, seemingly randomly.
    Is there any way to configure or prevent this?
    Thanks in advance and kind regards,
    Michael

    Hi,
    From your description, my understanding is that SharePoint changes the format of date in single line.
    It is very strange issue. I try to reproduce your issue in my environment, but everything is OK.
    To solve your issue, I need to collect some information, please confirm these points below:
    When will the format of date change? Does it change immediately when you edit the document or after clicking save button?
    Does the issue occur in this document library or each one in your environment?
    Do you have some special configurations for this document library?
    In addition, could you provide a screenshot as below?
    Best Regards,
    Vincent Han
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • I there an app to take a photo and insert it into a column on Iphone, input several other columns on the run and then later downloade to my laptop?

    May I take photo, insert into a spreadsheet, input info in several other columns; review and/or print; and download onto my laptop later?

    You can play with the 'route' command in an Applications -> Utilities -> Terminal session to specify which route a specific IP address should take.
    man 8 route
    Google can most likely give you examples you can use to specify routes.
    Routes must be setup after each reboot.

  • Populating a Sharepoint attendance list based on values entered in second list: Tracking attendance

    Hello,
    My organization is looking to move our attendance tracking from Excel to Sharepoint, and to automate the process while we're at it.
    In short: the company needs to track employee attendance at seventeen different training events (via the "Training Attendance" list). The facilitator of each event updates a different list ("Meeting Tracker") after each session, creating
    a new item on the list to track attendees. On this new item, the facilitator also looks up and chooses (via a People/Group column) all of the attendees (in the "Attendees" column). The title of each new item is the name of the training session, and
    this name also appears on the "Training Attendance" list.
    What I am looking to do is link this Attendees column on the Meeting Tracker to automatically populate the Training Attendance list. The idea is that when a facilitator updates the Meeting Tracker list with the names of all attendees, these attendees will
    automatically be marked as having attended that class on the Training Attendance list. While tracking in Excel I have used "VLOOKUP" and "COUNTIF" functions to achieve this same result.
    So far I have tried various methods to do this but have had no luck, mainly due to the fact that it does not appear possible to use a look up function with a People/Group column. 
    Does anyone know of any other solutions or workarounds for this problem? Any suggestions would be very appreciated.
    Thank you!

    Dear Niall
    Many thanks for all your help and support to help me with this issue.  I had a think about it over the weekend and basically the solution that seems to work is to clear the list box each box each time a drop down is entered using the PreOpen event and then when a drop down is selected with a value greater than 0 an item is added to the listbox using the addItem with the inclusion of the rawValue from the drop down list in the item addd to the list box.
    ie. if (Page1.DropDownList.rawValue != 0) {
    Page1.ListBox.addItem(Test - "+Page1.DropDownList.rawValue+"")
    Your suggestions and help got me there in the end so a big thanks and I think this way will improve the performance of the form compared to what I thought I might have to do.
    Many thanks
    Darren

  • Dynamic Link Column Based on Value

    I'm using Apex version 4.1.
    This is driving me nuts, I can't get it to work. I'm trying to create a dynamic link on a column (in a SQL report) based on the value. Here's my query:
    SELECT STRUCTURE_ENTITY_ID AS "Market ID",
    Structure_entity as "Market Name",
    CASE WHEN NVL2((select 'A' from PC_PAYROLL_DISTRIBUTION PD
    WHERE PROCESSING_YEAR = SUBSTR('2011-08',1,4)
    AND PROCESSING_MONTH = TO_NUMBER(SUBSTR('2011-08',6,2))
    AND PD.OPS_MARKET = SE.STRUCTURE_ENTITY_ID
    AND ROWNUM = 1),'Ready','Not Ready') = 'Ready' THEN '' ||'' ELSE 'Not Ready' END AS Status
    FROM STRUCTURE_ENTITY SE
    So when the value in that CASE statement equals 'Ready' then I need it to show the word Ready (in the Status column) as a hyperlink, otherwise it needs to show 'Not Ready' in normal text that's not clickable.
    The URL string I have in there DOES pick up the correct values for my parameters, but it stilll appears in the report as the whole string, and it's not clickable. Any help would be greatly appreciated!
    Thanks,
    Greg

    I see an a instead of <a and no </a> in this code.
    Oh, I guess your {a is <a ... B-)  Still no end tag, though.
    Edited by: InoL on Oct 7, 2011 2:27 PM                                                                                                                                                                                                                                                                                                                       

  • Filter column based on values in second column

    I have a 7 columns (A-G). I want to add a filter to return rows if the value in column D exists anywhere in column C (values in column D and C do not necessarily match).
    Is this possible? I tried creating a filter for column D based on column C using the 'Filter based on results of another request' functionality, but it did not work.
    Create/Edit Filter>Filter based on results of another request
    Column: column D
    Relationship: is equal to any
    Saved Request: same request
    Use values in Column: column C

    Okay, it looks like you are using the same query for both the main and subquery. That won't work.
    1) Create a query with one column, column D. Name it and save it.
    2) Now build your main report with all the columns you desire and on column C, apply the filter "based on results..." and have it point to column D of the subquery in step 1.

  • Find duplicate values in a table based on combination of two columns.

    In table which have millions of records -
    I have a Table B under Schema A and i have to find the duplicate records in a table. My Table B uses the combination of columns to identify the unique values.
    Scenario is something like this-
    One SV_Id can have multiple SV_Details_Id and i have to find out if there is any duplicate in the table. (I have to use combination of columns to identify the unique values and there is no Primary Key, Foreign Key or Unique Key on the table)
    then wrote the following query -
    select SV_Id,SV_Details_Id count (*) from SchemaA.TableB group by SV_Id,SV_Details_Id having Count (*) > 1 ;
    Is it correct as after firing the above query it is returning the rows which is not matching to the duplicate.
    kindly help me.
    Looking forward for some guidance -
    Thanks in advance.

    What is the desired output??
    Do you want to see only unique records??
    Or you want to see the duplicate records.
    Giving an example will make it easier to provide the required querty.
    BTW here is an simple query which is used to delete the duplicate records and keep the unique records in table.
    DELETE
      FROM table_name     a
    WHERE EXISTS (SELECT 1
                     FROM table_name      b
                    WHERE a.sv_id         = b.sv_id
                      AND a.sv_detail_id  = b.sv_detail_id
                      AND a.ROWID         > b.ROWID
                   );Regards
    Arun

  • Count of Column  based on Value

    Hi All
    In our database table we have 3 columns closedate,empcode,status.
    I am using the following query to fetch the data required :
    select closedate,count(empcode) COUNT,EMPCODE,status from dbcleaning WHERE STATUS='Fixed' and EMPCODE='E315' group by closedate,STATUS,EMPCODE.
    the result is like this :
    closedate count EMPCODE STATUS
    2010-10-10 98 E315 Fixed
    2010-10-11 15 E315 Fixed
    However i want the data to be based on DISTINCT EMPCODE , fo Eample :
    closedate EMPCODE(ST001)       EMPCODE(ST002) STATUS
    2010-10-10 *98 125* Fixed
    2010-10-11 *128 225* Fixed
    I hope i had explained properly
    Replies are highly appreciated.
    Thank You
    Edited by: user9366471 on Jun 30, 2010 12:29 AM

    It's always a better idea to post DDL of your table and INSERT statement. Also don't forget to mention the output you required. It's even better if you use tag for those DDL and DMLs.
    Your database version is a important thing for exact solution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How do I return a value from a column based on info from neighboring columns?

    I have a table of data that looks similar to this:
    Weight
    Name
    School
    Division
    106
    Name1
    School1
    1
    106
    Name2
    School2
    2
    106
    Name3
    School3
    3
    106
    Name4
    School4
    4
    113
    Name5
    School5
    1
    113
    Name6
    School6
    2
    113
    Name7
    School1
    3
    113
    Name8
    School3
    4
    It's a very large table, so there will be multiple matches for Schools, and occasionally a few matches for Names, but there will always be only one match for a given Weight and Division.
    In a separate table, how can I get the name of the person associated with the unique weight and division?
    In my head, the formula goes" "Look in the Weight column to find 106, then look in the Division column to find 4, then return the value from the Name column." But I can't figure out the formula that will do that.
    Any thoughts?

    Hi momogabi,
    This can be easily done with an index column.
    The formula I used in your original table for the index column is:
    =A2&"-"&D2. This was filled down. The column can be hidden.
    You can see the formula in the search table. If I wanted to eliminate the index column in that table the formula would look something like:
    =INDEX('Table 1-1'::B,MATCH(A2&"-"&B2,'Table 1-1'::E,0),1)
    Hope this helps.
    quinn

Maybe you are looking for

  • ADF: Marker Texts Overlapping in Dual Y Graphs

    Hi, I am using a dual Y graph using ADF in which multiple series will be displayed in a graph. However, I am facing some issues in with the Marker Texts of different series as these are overlapping with one another. Please see my code snippet below :

  • IDOC ERROR STATUS 4

    Dear ALL, When invoice has been sent to the customer I come across the above error status the description of the error is as follows. "Trading Partner Not Found in TP XRef Database" for this please advice me where to check TIA, KOGI

  • Torque Control on componet at different temperatures

    Greetings,           I am in the process of building an application with Motion Control with change control modes from position control to Torque Control.  Here is my situation.  I am going to be twisting a rubber component from +- X Nm's at a partic

  • Premiere Elements Upgrade Installation

    Ich habe OS X Yosemite und Premiere Elements 11 auf DVD. Premiere Elements ist nicht installiert, weil ich es nach einem Neuaufsetzen von Yosemite noch nicht gebraucht habe. Ich überlege nun ob ich das Premiere Elements 13 Upgrade kaufe und dann inst

  • Conky matches GTK theme (concept)

    Concept: Conky executes a script every X seconds. The executed script checks to see if the GTK theme has changed. The script reads the GTK theme and finds FG and BG colours. The script performs a sed command on the conkyrc to alter text to the new FG