Need column showing 'Y' or 'N' values in query using Union

Hello Folks,
My 1st table is customer table with name, lastname, age, party id , custom id
2nd table is department table with party id , dupeflag
3rd table is sales table with custom id , indicator
I need to combine them and get a new column which has certain conditions.
Requirement:
Need name, lastname, age, party id , custom id , NewIndicator
and below conditions should be folllowed.
dupe flag indiactaor flag New Colum to have (say NewIndicator)
0,1,2 Y Y
3 Y N
0,1,2 N N
3 N N
I need to do a union to get all the values
select a.party_id from customer a join department b
on a.party_id=b.party_id
UNION ALL
select a.custom_id from customer c join sales d
on c.custom_id=d.custom_id
But now how do i build the case statement to fulfil my new column setting conditions.. I'm confused with case statemnent..
Please help ASAP..
Thanks..

How do I ask a question on the forums?
SQL and PL/SQL FAQ

Similar Messages

  • Adding new column in an existing report which was build using Union

    While working in OBIEE 11g I encounter an issue.
    My existing report was build using UNION at Criteria Tab in Analysis. Now I have a requirement to add a new column into the same report. For each criteria I have added the new column but when I go back to the "Result Columns". I see a new field added but it is not allowing me to open or edit column properties for that new column & at the same time it is not allowing me to navigate to other tabs like Results, Promts, and Advanced.
    I don’t want to build this report from scratch. Is there any workaround to get it resolved?

    Hi,
    Just check it once the new added column data types are mismatched or not?
    and the new added column should be navigated into excluded section, so u should edit the report and dragged into the table column section.
    Thanks..

  • Initial values in query using multidimensional authorizations

    Hi,
    so far reading here through the topics helped solving my issues, but know I have a problem with displaying the initial values in a query using multidimensional authorizations. We use BI 7 and have to user the authorization check from BW 3.5 (rsr).
    Following situation:
    - We have a two infoobjects "CLUST" and "P_CLUST" referencing to the infoobject "M_COSTELM" and using the same hierarchies.
    - The user should either see a specific value of CLUST and all values of P_CLUST or a specific value of P_CLUST and all values of CLUST in the reports. The values of CLUST and P_CLUST he's allowed to see are the same.
    - The role is declared as following:
    CLUST: * + P_CLUST [] + auth.object for CLUST
    PCLUST: * + CLUST [] + auth.object for PCLUST
    - Only one of those two infoobjects has to be set with a value in the query.
    Using the role as above and running a query, the rights management is working fine and the user only see's what he's allowed to.
    But when the user open's the query he see's the whole hierarchie in the inital values on the left and not only those nodes and leafs he should see.
    For example:
    Hierarchie "costelm_hier"
    ALL_NODES
    - FIRST NODE
       - FN_LEAF 1
       - FN_LEAF 2
    - SECOND NODE
      - SN_LEAF 1
      - SN_LEAF 2
    The user is allowed to see the FIRST_NODE and it's leafs in CLUST and P_CLUST.
    When he now open's a query with CLUST as the input-ready infoobject, in the initial values he see's the whole hierarchie and not only the FIRST_NODE with it's leafs.
    When then browsing through the tree and selecting the FIRST_NODE, in the query, the restrictions are working fine. He can see the FIRST_NODE in the infoobject CLUST and every values in P_CLUST. Also vice versa.
    As it's more user-friendly I only want the user to see the nodes and leafs he's has in his role.
    I also tried using an exit variable with the function 'RSSB_GET_AUTHS_FILTERED', but without success.
    Hope u understand me so far!?
    Thanks for your support!

    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • Need to retrieve all the node values of xml using DOM parser..pls help

    I want to fetch each node value in this xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <Main>
    <AAAAA>
    <ES>ESValue</ES>
    <EI>EIValue</EI>
    </AAAAA>
    <BBBBB>
    <SIP>
    <ST>STValue</ST>
    <TB>TBValue</TB>
    <PM>PMValue</PM>
    <VIP>
    <CARP>
    <AN1>AN1Value</AN1>
    <BN>BNValue</BN>
    </CARP>
    <DARP>
    <SA>
    <AN2>AN2Value</AN2>
    <CN>CNValue</CN>
    </SA>
    </DARP>
    </VIP>
    </SIP>
    </BBBBB>
    </Main>
    output should be the inner text values of diffrent nodes that contain some values..
    i.e
    output:
    ESValue
    EIValue
    STValue
    TBValue
    PMValue
    AN1Value
    BNValue
    AN2Value
    CNValue
    so that i can use thses node values and put it them in database...

    pls check the above xml file in proper redable order...I need to parse using DOM and fetch node values that are present...
    <?xml version="1.0" encoding="UTF-8"?>
    <Main>
        <AAAAA>
            <ES>ESValue</ES>
            <EI>EIValue</EI>
        </AAAAA>
        <BBBBB>
            <SIP>
                <ST>STValue</ST>
                <TB>TBValue</TB>
                <PM>PMValue</PM>
                <VIP>
                    <CARP>
                        <AN1>AN1Value</AN1>
                        <BN>BNValue</BN>
                    </CARP>
                    <DARP>
                        <SA>
                            <AN2>AN2Value</AN2>
                            <CN>CNValue</CN>
                        </SA>
                    </DARP>
                </VIP>
            </SIP>
        </BBBBB>
    </Main>

  • How to show only the result of a query

    Hi experts,
    i need to show only the result of a query (hiding all the rows)
    according to mathematical functions like sum, average, count ets. i need the result to be shown widhwise the query (Horizontal)
    thanks a lot
    Nir

    Hi
    I did get exactly.....but if i m right then you can do this by selecting the keyfigure goto the calculation tab select calculate result as sum or whatever you want to use.
    Regards
    Lalit k Tyagi

  • How to  get formated value from query

    i get value from query use the follow method
    Object obj1 = dataAccess.getValue(i,j,DataMap.DATA_UNFORMATTED);
    Object obj1 = dataAccess.getValue(i,j,DataMap.DATA_FORMATTED);
    the first method retrun a value '1666.0',
    the second method return a value null
    but i want to get the value '1,666'.
    who can tell me how can get the formated value?

    Ahu,
    An implementation of DataAccess is not required to support all DataMap constants. For example, the OLAP-based Query object does not support DataMap.DATA_FORMATTED. To find out which DataMaps are supported for a particular implementation, you can call the DataDirector's getSupportedDataMap method.
    If you have an Crosstab instance, there is a way to get the formatted cell value, based upon the formatting rules associated with the Crosstab. Get the GridViewFormatManager reference from the Crosstab, and call its formatDataValue method to return a String representation of the formatted data value.
    Hope this helps,
    djb

  • I have a column where I have implemented writeback, its working fine. On top of this I need to show 0 as No and 1 as yes in our report, that is also done. Now I want to enter Yes in a column where it was no and I want database table to get update with 1.

    I have a column where I have implemented writeback, its working fine. On top of this I need to show 0 as No and 1 as yes in our report, that is also done. Now I want to enter Yes in a column where it was no and I want database table to get update with 1. I am not sure how to do it. SOmeone please help me out.

    Hi ,
    In your write back XML  try the below  query insert
    INSERT INTO TABLE_XYZ (attribute1)  values (SELECT CASE  WHEN @{C1}=’Yes’ then 1 when @{C1}=’No’ then 0 else null end from dual)
    Regards
    Rajagopal

  • Need to show a data in weeks for stacked column

      I need to show the data broken down in weeks if you choose the start date and end date.   I have to show in a stacked column chart. I am trying to show the values if you choose for example last month i need to show it by weeks for example 
    week    user name   total approved first approved    last aprovedDate  totalitemsAdded
    week 1   XYZ                 3                10/01/2012       10/05/2012         5
    week2   XYZ                  5                 etc                      etc            
      etc
    week 3 
    Below is the code and the result  i am getting now . 
    Current Results
    UserName TotalApproved
    FirstApprovedDate LastApprovedDate
       TotalItemsAdded
    XYZ            9
               2011-11-19 16:56:49.960
         2011-11-19 18:18:20.783
                   2
    DECLARE @StartDate DATETIME
    DECLARE @EndDate DATETIME
    SET @StartDate = '10/1/2012 '
    SET @EndDate = '10/31/2012'
    ;with Items as(
           SELECT
                  UserName = Profile.Description,
                  TotalItems = COUNT(TransactionID),
                  FirstAddedDate = MIN(UTCDate),
                  LastAddedDate = MAX(UTCDate)
           FROM Transactiondatabase.dbo.transaction
                    JOIN Biography.dbo.Profile ON transaction.ProfileId = Profile.ProfileID
           WHERE 
                  Data like '%ItemAdded%'
                    AND UTCDate BETWEEN @StartDate AND DATEADD(dd,1,@EndDate)
           GROUP BY
                  Profile.Description 
    Approved as
           SELECT 
                  UserName = Profile.Description,
                  TotalApproved = COUNT(TransactionID),
                  FirstApprovedDate = MIN(UTCDate),--Demo
                  LastApprovedDate = MAX(UTCDate)                 
           FROM Transactiondatabase..transaction
                    JOIN Biography.dbo.Profile ON transaction.ProfileId = Profile.ProfileID
           WHERE 
                  Data like '%Approved%'
                    AND UTCDate BETWEEN @StartDate AND DATEADD(dd,1,@EndDate)
           GROUP BY
                    Profile.Description
    Select Distinct Approved.*, TotalItemssAdded = sum(distinct Items.TotalItems)
    from Items, Approved  
    Group by Approved.UserName, Approved.FirstApprovedDate, Approved.LastApprovedDate, Approved.TotalApproved
    using ssrs 2005 

    Hi Sunny04,
    If I understand correctly, you want to display the data by weeks in a stacked column chart. If in this case, we can add a calculated field named week to display the week name, and then group it. For more details, please see the following steps:
    Right-click the dataset to add a calculated field with the values below:
    Name: Week
    Calculated field: =DatePart(DateInterval.WeekOfYear,Fields!FirstApprovedDate.Value,0,0)
    Add Week field to category group area in a stacked column chart.
    Right-click Week field to open the Properties dialog box, modify the expression of Label to like this:
    ="week"&Fields!Week.Value
    Add TotalApproved or TotalItemsAdded field to data area in the chart.
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Workflow status column is not showing the internal status values (Inprogress, Started, Suspended, Completed)

    I've created SPD 2013 workflow and deployed them onto that document library, This workflow execute on item update event. When updating library item, workflow triggered and completed successfully but workflow status column is not
    showing the Internal Status values rather it is showing the Stage information. I've unchecked the "Automatically update stage name on workflow status" and republished the workflow. After that, it is still showing the stage information. Any help
    is really appreciated.

    Hi Venkadesh,
    It is by design that 2013 workflow will show stage name in the workflow status column when
    Automatically update the workflow status to the current stage name is checked.
    And the workflow status column will be blank when Automatically update the workflow status to the current stage name is unchecked.
    For existing workflows, the workflow status will still exists with the previous values after unchecking Automatically update the workflow status to the current stage name.
    We can use Set Workflow Status action to update the workflow status value based on our needs.
    Best regards,
    Victoria
    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]

  • Need to show some values from Lookup in Text Area of Request Dataset

    Hi,
    I have a requirement where I need to display values(which are roles) coming from a lookup in text area. The reason behind is to show to end users list of roles. They should not be able to select these roles.They will just refer the list and enter desired role in a text field. I thought of using text area as the component to be used for showing these roles. However, I cannot use lookup property for widget="textarea" in the request dataset.
    Can we do this or is there any other component where I can show list of roles so that users can just refer the list.
    Thanks.

    Lookup Property ??
    TextArea is different type of widget. It doesn't come with lookup.
    Search developer's guide.
    – textarea: Specifies a large text field for entering multiple lines of text.
    Even if they select then don't use that field for further processing. You can use Attribute instead of AttributeReference.
    Workaround:
    Have one text are and use Prepopulate adapter to populate those values.

  • Direction Needed: Storing calculated values from datagrid column in order to call values into graph

    Hi all,
    I am new to Flex/Flash Builder, actionscript, and mxml, so please be kind.
    I have developed a small program that has a component that displays a datagrid fed with information out of a mysql db via a php data services connection. Within that same component (page), I have a graph that charts the dates via a plot chart. I am interested in adding a line series to the graph, but the data I want to use is a calculated field in the datagrid which I used a custom lable function to derive and display. Can someone steer me to the correct method to store such values and how to call them into a chart?
    Some addition information
    Custom label function:
      /* Custom label function for the Delta1 column. Calculates the number of days between the planting date and 10% flower. */
                                  private function calculateTo1stFlower(item:Object, column:GridColumn):String {
                                            var tempDate1:Date = new Date(item.dflower10 - item.dplanting);
                                            return Math.round((tempDate1.time / MS_PER_DAY) + 1).toString();
    /* Number of milliseconds in a day. (1000 milliseconds per second * 60 seconds per minute * 60 minutes per hour * 24 hours per day) */
                                  private const MS_PER_DAY:uint = 1000 * 60 * 60 * 24;
    Within my spark datagrid
    <s:GridColumn width="30" headerText="Δ1" labelFunction="calculateTo1stFlower" ></s:GridColumn>
    I assume I need to store the array of values for this column and then chart the saved values as the xField within the LineSeries. Should I use a class based model?
    The following link seemed like it may be an appropriate path; I am not sure though.
    http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7b51.html
    Thanks in advance for any support,
    Matthew

    Thanks for trying to post DDL, but you have no idea how to do a data model. You do not know that tables have to have keys, what ISO-11179 is, etc. 
    You have a table that is supposed to model companies. Your singular names says that there is only one company!  There is no company identifier (the industry standard is the DUNS). A customer is not a company. We do not use numeric data types for identifiers;
    do you do math on them? NO!  The attribute property comes after the attribute name (you never heard of ISO-11179). 
    Think about how silly VARCHAR(1) is. 
    CREATE TABLE Companies 
    (company_duns CHAR(9) NOT NULL PRIMARY KEY, 
     company_name VARCHAR(30)NOIT NULL, 
     margin_oil INTEGER NOT NULL, 
     margin_hangar INTEGER NOT NULL, 
     margin_cleaning INTEGER NOT NULL);
    INSERT INTO Companies
     VALUES (1, 'AviatKorea', 100, 125, 200), 
    (2, 'AXHollande', 50, 40, 30), 
    (3, 'BFXNorway', 60, 80, 600), 
    (4, 'EEEFrance', 10, 25, 60);
    CREATE TABLE Company_Tariffs
    (company_duns INTEGER NOT NULL
       REFERENCES Companies(company_duns), 
     tariff_type CHAR(1) NOT NULL
        CHECK (tariff_type IN ('A','B','C','D'),
     PRIMARY KEY (company_duns, tariff_type));
    INSERT INTO Company_Tariffs values (1, 'A'), (2, 'C'), (2, 'D'), (3, 'A'), (4, 'A'), (4, 'C'), (4, 'D')
    SELECT * -- do not use * in production code
      FROM Companies AS C,
           Company_Tariffs AS T 
     WHERE C.company_duns = T.company_duns;
    >> I would like something like with a computed column [ ] that retrieves the different contracts used: <<
    You might but a SQL programmer would not. This violated First Normal Form. It is a display report and is done in the presentation layers. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Need help with Javascript to get value of standard report column

    Hello All,
    Apex version 3.1
    I have a SQL Query (Updateable report) region where I need to do some validations using an OnDemand Applicaiton Process and javascript. For this validation I need to use the serial number and the item id from the same report row. The function is called when the serial number is changed. I can get the serial number easily because it is a Text field, however the item id is a standard report column (making it a text field or hidden gives me a checksum error, long story). How do I get the value for the standard report column in order to set the value for an Application item to be used in my Application Process along with the serial number? Here is my code below.
    <script>
    function f_ValidateSerial(pThis)
      // The row in the table
      var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
        //alert('Row is '+vRow);
      // Display the serial number
        //alert('The Serial Number is '+html_GetElement('f21_'+vRow).value);
    var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=ValidateSerial',0);
    get.add('F101_SERIAL_NUMBER',html_GetElement('f21_'+vRow).value);
    get.add('F101_INVENTORY_ITEM_ID',+html_GetElement(?????+vRow).value);   // Here's where I need to get the item id to set application item!!
    gReturn = get.get();
    if (gReturn)
          alert(gReturn);
      if(gReturn)
          html_GetElement('f21_'+vRow).value = '';
    </script>

    jarola wrote:
    Hi,
    Ok, No standard report column do not have name attribute-
    You can add one extra column to report that is your Item Id with different alias.
    Then change that column Display as to "Hidden".
    Now you have hidden input where is your Item Id. Than input have name and id.
    Regards,
    JariBut this puts me back to my initial problem. When making the column hidden I get the checksum error...
    Error in mru internal routine: ORA-20001: Error in MRU: row= 0, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process...
    The item id is NOT in the table which I am updating (I use a subquery to get the data) so I think it has to be a standard report column. Hidden and Text Item (which have an item id) all generate the checksum error.
    So I think I'm back to my original question. Given a standard report column on a row in a sql query (updateable report) region how do I get the value using Javascript?
    Edited by: blue72TA on Aug 2, 2011 12:07 PM

  • Ok, im new to numbers but i cant work this one out. In column A is an average of hours worked. I have 4 columns. A and B have different values. Column C is an average of hours worked. When column C is less then 8 i need column D to equal column a

    Ok, im new to numbers but i cant work this one out. I have 4 columns. A and B have different values. Column C is an average of hours worked. When column C is less then 8 i need column D to equal column A. When column C is equal or greater then 8 i need column D to equal the sum of A and B.

    Hi Lucas,
    Try this:
    Formula in D2 (and Fill Down) =IF(C2<8, A2,A2+B2)
    The IF function follows the logic of if, then, else.
    IF(this is true, then do this, else do that)
    If it is raining, then stay at home, else hold a picnic .
    Regards,
    Ian.

  • Need to show default value in a form

    hi this is azhar..i have a question..
    i have created a form that displays values using a dyanimc lov however i need to show the default value as 'NA' which is one of the values in the lov..plz let me knw ...

    Hello Azhar,
    Just set the "Initial Value" property of the LOV's associated item to "NA".
    Hope this helps.
    Craig...

  • Need to show DFF Values on Web Form

    Hi All,
    I need to show DFF values on Web Form without customization , is it possible with Personalization?
    Regards,
    Sajid

    This is quite Possible with Seeded OAF page.
    Check first if DFF already on page using the personlization.
    If It is not available you can include flex item using personlization for enabling the DFF.
    Check this notes
    How To Add Descriptive Flexelds (DFF) To An Oracle Appplication Framework Page By Personalization [ID 430310.1]
    Thanks

Maybe you are looking for

  • How Long Did it Take to Receive Your Replacement?

    My shuffle is crapped out. I don't have phone support so I have to request service through the website. Apple says they will ship a new one to me...however, my question is: How long will it take to receive it? Does anybody know how quickly things are

  • DB02 Issue

    Hi, Please help me with the following questions 1)How do we activate Database connection RFC in DB02,as the values for space overview are all zero.Its a new implementation. 2)I can not see a component as ST-A/PI in ECC6 however ST-PI is there.I have

  • Apply update 7.0.3 to Developer version of InDesign Server

    Is there any way i could apply this update to a developer version of InDesign Server? We have an export PDF problem with our Live InDesign Server which we can replicate on our development server. I would like to apply the update to our development se

  • Language in smartform

    hello guyz, i wanna develop a smartform in norwegian ..how can i do it.. plz advise.. regds

  • BW 3.1 to BI 7 Upgrade Non Regression Tests

    Dear All, I am planning a BW 3.1 upgrade to BI 7. I need to focus on Non-regression tests. In others words, I would like to know what kind of non-regression tests I will have to do to confirm the UAT. I am not talking here about post-upgrade activiti