Selection of the list of clients using the clause "EXISTS".

Dear all,

I have 3 tables, say,

TABLE1:

 

CUST_CODE

(PRIMARY KEY)

CUST_NAME

CUST_COUNTRY_CODE

CUST_CITY_CODE

CUST_AREA_CODE

A

CUST1

COU1

CIT1

A1

B

CUST2

COU2

CIT2

A2

C

CUST3

COU2

CIT2

A3

D

CUST4

COU3

CIT4

A4

E

CUST5

COU3

CIT5

A5

TABLE2

 

STOCK_SYS_ID

(PRIMARY KEY)

STOCK_CUSTOMER_CODE

STOCK_CUSTOMER_

COU_CODE

STOCK_

CUSTOMER_

CIT_CODE

STOCK_

CUSTOMER_

ARE_CODE

STOCK_DOC_

CREATED

1

A

[Leaving empty as we have reference only to the customers and the date here...]

10/15/2015

2

B

15/09/2015

3

A

16/08/2015

4

C

18/08/2015

5

E

22/07/2015

6

C

31/01/2015

7

A

15/10/2014

TABLE 3

 

AREA_CODE

AREA_COUNTRY_CODE

AREA_CITY_CODE

A1

COU1

CIT1

A2

COU2

CIT2

A3

COU3

CIT2

A4

COU3

CIT3

A5

COU4

CIT5

How can I find the list of clients of TABLE1, which are present in TABLE2 by 2015 and have country-city-zone, both correct mapping as specified in section TABLE3 using the clause "EXISTS".

Is that my output will be like,

 

CUST_CODE

(ONLY CORRECT CUSTOMER CODES)

CUST_NAME

A

CUST1

B

CUST2


Thanks in advance,

Séverine Suresh

Hello

So, you want to see 3 columns in table1 correspond to 3 columns in t3.  It is not enough for only 1 column equal:

Area_Code must be equal

country_code and must be equal

city_code and must be equal.

Here's a way to encode that, by using the EXISTS operator in a WHERE clause:

SELECT cust_no, cust_name

FROM table1 t1

WHEN THERE IS)

SELECT 0

Table 3 T3

WHERE t3.area_code = t1.cust_area_code

AND t3.area_country_code = t1.cust_country_code

AND t3.area_city_code = t1.cust_city_code

)

;

I hope that answers your question.

If not, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results you want to start from these data (otherwise what you've posted already).

Explain, using specific examples, how you get these results from these data.

Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: Re: 2. How can I ask a question on the forums?

Tags: Database

Similar Questions

  • I'm not finding a choice selection of development under my Select drop-down list.  I use the latest version of Photoshop CC

    I'm looking in the wrong place for the new development tool in the latest version?  I'm looking under Select but don't see no choice.

    Thank you, Bob

    As I suspected, you run the old software.

    32 or 64-bit isn't the issue here.

    Adobe has released Photoshop CC version (2014) as a completely separate release, which installed in a completely different place that the CC Photoshop 14.x you are running.

    You must find that place and update the process that you use to start the application to launch the new version.

    -Christmas

  • How to select a cell in a multicolumn list box and use the horizontal scrollbar on th

    An event structure, how to select a cell in a multicolumn list box and use the horizontal scrollbar on the front panel at the same time.  I can select a cell in the multicolumn in a structure of the event, but I can't move the scroll bar on the front panel when the program is running.

    I guess that you are referring to the scroll bar in the control multi-column listbox. What does your code when you select a cell? Can you please your postal code so that we can see the behavior you describe? It is possible that you are blocked the structure of the event, as in performing an operation long in case the treatment cell selection. In this case, the structure of the event must wait until the event ends before being able to respond to the next event. You can configure the event to not lock the front panel until the event ends.

  • Development of the selection list after refresh using jQuery

    Hi all

    I have an Express Application 4.1.1.00.23 application that runs on a server, Oracle 10 g R2.

    In the application, I have a page (suppose it to be Page 10) that has a drop down (let's call it P10_PARENT). Next to the dropdown menu, I have a button that when clicked opens another window popup with page 11. This 11 page is used to create many of the points listed by the P10_PARENT drop down. When enter us the data P11 and click OK, we have a javascript to call a process application that creates the object in the database. Now select the P10_PARENT list is updated to reflect this new object. So after the application process is running, the JavaScript on the Page 11 calls a function in Page 10, using window.opener.functionName. This Page 10 function performs an apex to help refresh

    $('#P10_PARENT').trigger('apexrefresh');
    

    This function returns the Page 11, the page is closed using the Window.Close ().

    It works fine up until this point. Now, there are also by default the value selected in the select list of the newly created object. We made a function for it. But he calls immediately after the outbreak of the updating of the apex does not work because he probably did not updated the list since the back end still.

    Therefore link us an apexafterrefresh event to this element and making the default here. Like this:

    $('#P10_PARENT').bind('apexafterrefresh',function(){
      setdefault('P10_PARENT',newCreatedObjVal);
      alert('Refresh completed!');
    });
    

    But this event does not seem to be triggered. I've tested in IE and Chrome. In Chrome, it started once, but never after that.

    The relevant code on page 10 looks like this. The refreshBusList function is called Page 11 with the value of the newly created object.

    function refreshBusList(pDefault)
    {
      newCreatedObjVal = pDefault;
       $('#P10_PARENT').trigger('apexrefresh');
    }
    
    $('#P10_PARENT').bind('apexafterrefresh',function(){
      setdefault('P10_PARENT',newCreatedObjVal);
      alert('Refresh completed!');
    });
    

    I would like to know what we're doing wrong. Is it still the right way to do it? I can't use dynamic actions here because the logic of javascript page is too complicated be properly implemented using the declarative logic like DAs (we tried once and had to leave after a week. has become a nightmare to manage).

    Any help would be much appreciated!

    Thank you!!

    Aalami

    What does setDefault? Have you tested this feature by running it from the console? It doesn't have the required behavior?

    Can what newCreatedObjVal value contain? What is an object? A string?

    Are you sure that the selection list is updated?

    I would also like to rewrite your refresh logic. On the one hand, you declare a variable of global scope: horrible! There is no need of it. You can also control refreshing after a little better by simply acting on it once.

    function refreshBusList(pDefault)
    {
      // not really necessary. But use "var" to declare scoped variables!
      var newCreatedObjVal = pDefault;
    
      // bind a one time afterrefresh event handler
      // then, trigger the refresh
      $('#P10_PARENT')
      .one('apexafterrefresh',function(){
        setdefault('P10_PARENT',newCreatedObjVal);
        alert('Refresh completed!');
      })
      .trigger('apexrefresh');
    }
    
  • selection of the dates not used for the list

    OK, the last one for today...

    I'm trying to fill a list with values of the month years between the first entry in the table and the month previous (sysdate - 1 month).

    At the moment I have this, which will select every month between the last entry in the table and sysdate-1.
    select to_char( add_months( start_date, level-1 ), 'MON-YY' ) d, to_char( add_months( start_date, level-1 ), 'MON-YY' ) r
    from (select add_months(max(date_received),1) start_date, add_months(sysdate, -1) end_date from localdata) where start_date < end_date
    connect by level <= months_between(trunc(end_date,'MM'), trunc(start_date,'MM') ) + 1
    But I want it uses the first entry and select all the months between then and sysdate-1 where there is no entry in the table.

    I tried something like that, but it returned no data:
    select to_char( add_months( start_date, level-1 ), 'MON-YY' ) d, to_char( add_months( start_date, level-1 ), 'MON-YY' ) r
    from (select min(date_received) start_date, add_months(sysdate, -1) end_date from localdata) where start_date < end_date and to_char(start_date, 'MON-YY') not in (select to_char(date_received, 'MON-YY') from localdata)
    connect by level <= months_between(trunc(end_date,'MM'), trunc(start_date,'MM') ) + 1

    Hello

    pearlyred wrote:
    Thanks for the comment tip, it works great now. I just need how to sort date wise.

    If missing_month is a string, such as "JAN-2013", then it's not good for sorting, since the string "JAN-2013" come after "FEB-2013"(et aussi après «FEB-2014"et «FEB-2015") because 'J' comes after 'F'. "»»» If you want to sort, and then keep the month as a DATE, like this:

    WITH     got_missing_month_s     AS
    (
         SELECT     ADD_MONTH first_month, LEVEL - 1)     AS missing_month_s
         FROM     (
                   SELECT TRUNC ( MIN (date_received)
                                           , 'MONTH'
                                  )          AS first_month
                   FROM   localdata
              )
         CONNECT BY     LEVEL     <= MONTHS_BETWEEN ( SYSDATE
                                                 , first_month
                                          )
        MINUS
            SELECT  TRUNC (date_received, 'MONTH')
         FROM     localdata
    )
    SELECT       TO_CHAR (missing_month_s, 'MON-YYYY')     AS missing_month_d
    ,       missing_month_s
    FROM       got_missing_month_s
    ORDER BY  missing_month_s
    ;
    

    The main request has 2 columns:
    missing_month_d is for display: it's a string such as "JAN-2013".
    missing_month_s is for sorting: it's a DATE.

  • Index selected in the pop-up list

    I now have the code sucessfully fills a table for use with a pop-up box.

    I have problems to get the correct index selected in the box, however.

    the table being introduced in the pop-up list is JUST strings

    FOR EXAMPLE:

    myArray = OtherString, Stuff, a phrase, an example of House

    in a function, I make the pop-up box with 2 buttons and an event listener:

    // add buttonsp.addButton("QuizMe!");p.addButton("Search Again");p.addEventListener(Event.SELECT, getIDFromClicked);
    

    The function I use to capture the entrance

    private function getIDFromClicked(e:Event){
    
           var d:PopupList = e.target as PopupList;
           //retrieve the selected index/indices
           trace("Selected Index : " + d.selectedIndex.toString() + " ");
           trace("Selected Index : " + d.selectedIndex + " ");
    
    }
    

    This will display

    Selected Index : 0
    Selected Index : 0
    

    even if you select articles 15 (out of 29) on the shortcut menu.

    I was watching several examples how do I capture the selected index entry and I believe that my code to work properly, but I can't seem to understand why the index is * always * 0.

    thoughts?

    Hey dtater,

    the selectedIndex property returns only the selected from the pop-up button. to get the index of the selected array element, you can use the selectedIndices property. an example would be:

    (in your event listener)

    trace("Selected index: " + d.selectedIndices[0]);
    

    hope that helps. Good luck!

  • I am trying to perform a static check on the model. When I double click the model and go to the tab control... There is nothing to select in the knowledge module. I want to use CKM here... but nothing appearing in the drop-down menu. The global KMs are no

    I am trying to perform a static check on the model. When I double click the model and go to the tab control... There is nothing to select in the knowledge module. I want to use CKM here... but nothing appearing in the drop-down menu. The global not supposed to KMs the listed here?

    Hello

    You have imported the whole CKM in modules of knowledge?

    If not, import ckm and do it.

    Kind regards

    Gangareddy.k

  • Selection of nodes in tree ADF using the checkbox

    Hello

    I have a tree of the ADF based on two your (Master VO and VO child referential cottages). I have a requirement to select the nodes in the tree using a checkbox for each node in the tree. I need to move the nodes selected for the TF call by clicking on the OK button. The problem that I am running is

    Ideally if I can add the node in a list, whenever the checkbox is enabled or delete it from the list when the check box is not selected, it would have been the best solution. How ever on by activating the check box for a node directly the change event of the checkbox value is raised before the selection event and so I do not have the current node. Is there a way to implement a tree ADF with selection of the checkbox for all nodes?

    Currently how I implement it is clicking OK I iterate over all records to see which has the transitional attribute corresponding to the box set to true but it must treat all records in the tree and it is an expensive process, especially when my tree is much larger.

    Thank you

    Hi user,

    I don't know if your 'best solution' is actually the best, but I can help you get there.

    Check this blog for you will learn how to ID in the changeValueEvent box.

    ADF tips: how to get the value of the user interface components. | Oralublog - Blog of Oralution

    In the example I use an actionEvent. The changeValueEvent should give you the same functionality.

    Now that you have the RowId, you might be able to achieve your solution using your list.

    Concerning

  • Hi, PDF form of the guru. How to make a text box become a required field IF a drop-down list is selected as the "Yes"?

    Hi, PDF form of the guru.

    How to make a text box becomes a "required field", IF a drop-down list is selected as the "Yes"?

    and 'not required' if the drop down menu selected as 'No' or left blank.

    Any help would be greatly appreciated

    see you soon

    Use this code in the custom drop-down list field validation script:

    this.getField("Text1").required = (event.value == "Yes");

    (Change "Text1" to the actual name of your text field, of course)

  • I can not find, select, install the appropriate SR2 extended RAW for Phtoshop CS6 file to use with my Canon 5DSR camera... Please help

    I can not find, select, install the appropriate SR2 extended RAW for Phtoshop CS6 file to use with my Canon 5DSR camera... Please help

    Hi drdrum,

    Greetings!

    Update the software of camera raw as Canon 5DSR is supported camera raw version 9.0 and above.

    Here is the download link: https://helpx.adobe.com/x-productkb/multi/update-error-u43m1d204.html

    Also, here is the list that displays the camera with respective camera raw support:https://helpx.adobe.com/camera-raw/kb/camera-raw-plug-supported-cameras.html

    Concerning

    Jitendra

  • I use LR5.  I have not a selection in the edit tab allows you to create keyboard shortcuts?

    I use LR5.  I have not a selection in the edit tab allows you to create keyboard shortcuts?

    Lightroom keyboard shortcuts are coded hard and cannot be changed by the user.

    See here for the list:

    Lightroom help | Keyboard shortcuts

  • Select the query with the level line list where the clause

    Hi all

    I am creating a tabular presentation based on a SQL query that has a list of selection based on a query with a where clause clause that refers to a column in the original SQL query.

    The situation is, I have a table that stores the client_id, source_id, and build_id, lets call it client_source. I have a second table, build_source, containing source_id and build_id, one to many relations between the two (1 source_id could have build_id 1-7).

    Using a tabular presentation, I want to select the correspondent build_id to use in client_source, but the selection list should contain only the build_id for this particular source_id of lines.

    Here is an example of the SQL source of tabular presentation;

    Select
    s.ROWID,
    s.CLIENT_ID,
    s.SOURCE_ID,
    APEX_ITEM. SELECT_LIST_FROM_QUERY (1, s.BUILD_ID,)
    "Select display b.build_id, b.build_id return.
    b build_source where b.source_id = s.SOURCE_ID ') lst
    of s client_source

    what I want to achieve, it's as source_id "BOLD" match fields. When the query is built this way, I get an error of "invalid identifier" Oracle on s.SOURCE_ID during execution.

    Is there some special tags to be used to refer to the external column? I must be missing something because this looks like a pretty mundane problem.

    I am running on 4.1.0.00.32, on an Oracle 10 g release 10.2.0.4.0 Server Express request.


    I look forward to useful responses!


    See you soon,.
    Jason

    Published by: 1005131 on May 9, 2013 19:02

    Your selection by query list receives a static SQL. That SQL can't "see" the value of your s.source_id.
    But it would work like this:
    where b.source_id = ' | s.SOURCE_ID)

    You would be the value for the SQL concatenation. It is not ideal, but it will work.

    Jorge

  • Store the days selected as a whole in db using ADF

    Hello

    I use Jdeveloper 11.1.2.3.0

    We will migrate a JSP/Servlet to ADF application.
    In one of the pages, let us the user select the days where he would like an operation to get.
    Basically, we use the bitwise operations to convert the selected fields from a binary string to an integer, and that integer is stored in the db.
    You can see the idea here

    Since we cannot change the table, we find a workaround for the ADF.
    I thought about creating a transitional attribute in the object view that contains the binary string, and in this way the (integer) attribute initial will be calculated by converting binary to decimal in the code.
    Now my problem is how can I get the days selected from the page and store in the chain. What should I use as a component? And how should behave the LOV (which I think will be necessary)?

    Appreciate your help,
    MB

    Looks like a can be used to select and display the days.
    All you have to do is to read the value of the db and assign it to the value property. Here, you will have to use logic you need to calculate what day to select.
    You can use a converter allowing to calculate the list for the and the integers for the db.

    Timo

  • Set the focus on the list of selection in the form of the APEX

    Dear friends,
    I want to set focus on the first field of the new line of tabular presentation.
    I used something like that.

    JavaScript:AddRow();
    $('input:enabled:visible:last').focus ();

    It works fine if the first field is the text field. but when I put the selection list in the first field in tabular form, it does not work.

    Can you help me in this problem.

    Thanks in advance.

    This is because a selection list is not an input field. The html code is different, where the selector of is not picking it up.
    If you were to use

    $('select:enabled:visible:last').focus();
    

    He would choose the latest list of selection (on the page).

  • Make a visible selection during the withdrawal in a drop-down list

    Good day all.

    I am putting together a form where I have a drop-down list that contains 3 choices. When one of these choices is selected in the drop-down list, a table becomes visible to the user to fill out.

    The question I have is when the user selects in the drop-down menu, the table is not visible unless the user clicks in the fall down once again.

    I tried an event ' click and exit "and came with the same question.

    Here is the code I use. I would appreciate help with this.

    Chomp

    if (this.rawValue == '5') { }

    term_select. Presence = 'visible';

    }

    if (this.rawValue ! = '5') { }

    term_select. Presence = 'hidden';

    }

    if (this.rawValue == '6') { }

    temp_select. Presence = 'visible';

    }

    if (this.rawValue ! = '6') { }

    temp_select. Presence = 'hidden';

    }

    if (this.rawValue == '7') { }

    act_select. Presence = 'visible';

    }

    if (this.rawValue ! = '7') { }

    act_select. Presence = 'hidden';

    }

    You must use xfa.event.newText to get the selected value.

    The change event:

    var newValue = this.boundItem(xfa.event.newText);
    
    if (newValue == "5") {
        term_select.presence = "visible";
    }
    
    //etc.
    

Maybe you are looking for