Cross connection request, search for unpaired data

Always on Oracle 11.2.0.1.0

Sample data:

In connectionA
CREATE TABLE datasampleA (
         RID NUMBER(10) PRIMARY KEY,
         employeeNumber NUMBER(9),
          employeeName VARCHAR2(15),
         jobID VARCHAR2(10),
         job_date   DATE,
         active  NUMBER(9)
       )
;
 
INSERT INTO datasampleA VALUES(121420,100171,'Jack',411,'03-JUN-99',1);
INSERT INTO datasampleA VALUES(119590,100244,'Elizabeth',409,'13-SEP-99',1);
INSERT INTO datasampleA VALUES(124252,100352,'Amy',7646,'25-MAY-08',1);
INSERT INTO datasampleA VALUES(124253,100514,'Jonathan',642,'06-MAR-05',1);
INSERT INTO datasampleA VALUES(116592,100526,'Ruben',642,'20-FEB-05',1);
INSERT INTO datasampleA VALUES(116593,100526,'Ruben',7646,'20-FEB-05',0);
INSERT INTO datasampleA VALUES(122273,100526,'Ruben',7646,'12-JAN-03',0);
INSERT INTO datasampleA VALUES(121142,100615,'Peter',7646,'21-JUN-99',1);
INSERT INTO datasampleA VALUES(116594,100822,'Kathee',642,'20-MAR-05',1);
INSERT INTO datasampleA VALUES(119354,100890,'Christopher',7647,'28-AUG-11',0);
INSERT INTO datasampleA VALUES(417079,100890,'Christopher',7646,'28-AUG-11',1);
INSERT INTO datasampleA VALUES(122128,100946,'Christopher',411,'11-MAR-02',1);
INSERT INTO datasampleA VALUES(118382,100963,'Kristi',8470,'01-AUG-10',0);
INSERT INTO datasampleA VALUES(1252467,100963,'Kristi',8473,'01-AUG-10',1);
INSERT INTO datasampleA VALUES(119355,100989,'Christopher',8473,'18-JUN-01',1);
in connectionB
CREATE TABLE datasampleB (
          RID NUMBER(10) PRIMARY KEY,
         employeeNumber NUMBER(9),
          employeeName VARCHAR2(15),
         jobID VARCHAR2(10),
         job_date   DATE,
         end_date DATE
       )
;

INSERT INTO datasampleB VALUES(121420,100171,'Jack',415,'03-JUN-99','05-DEC-99');
INSERT INTO datasampleB VALUES(119590,100244,'Elizabeth',413,'13-SEP-99','13-SEP-99');
INSERT INTO datasampleB VALUES(124847,100244,'Elizabeth',642,'30-DEC-01',NULL);
INSERT INTO datasampleB VALUES(124252,100352,'Amy',7650,'25-MAY-08','03-SEP-10');
INSERT INTO datasampleB VALUES(124253,100514,'Jonathan',646,'06-MAR-05','05-JUN-05');
INSERT INTO datasampleB VALUES(116592,100526,'Ruben',646,'20-FEB-05',NULL);
INSERT INTO datasampleB VALUES(116593,100526,'Ruben',7650,'20-FEB-05','29-AUG-10');
INSERT INTO datasampleB VALUES(122273,100526,'Ruben',7650,'12-JAN-03','29-AUG-10');
INSERT INTO datasampleB VALUES(121142,100615,'Peter',411,'21-JUN-99',NULL);
INSERT INTO datasampleB VALUES(116594,100822,'Kathee',646,'20-MAR-05','21-OCT-06');
INSERT INTO datasampleB VALUES(119354,100890,'Christopher',7650,'28-AUG-11','28-AUG-11');
INSERT INTO datasampleB VALUES(417079,100890,'Christopher',7646,'28-AUG-11',NULL);
INSERT INTO datasampleB VALUES(122128,100946,'Christopher',415,'11-MAR-02','27-JUN-02');
INSERT INTO datasampleB VALUES(118382,100963,'Kristi',8477,'01-AUG-10','01-NOV-11');
INSERT INTO datasampleB VALUES(831596,100963,'Kristi',8473,'01-AUG-10',NULL);
INSERT INTO datasampleB VALUES(860841,100963,'Kristi',8477,'01-AUG-10','01-MAR-12');
INSERT INTO datasampleB VALUES(1252467,100963,'Kristi',8477,'01-AUG-10','01-MAY-12');
INSERT INTO datasampleB VALUES(119355,100989,'Christopher',410,'18-JUN-01',NULL);
INSERT INTO datasampleB VALUES(119356,101141,'Jared',416,'12-SEP-99','30-JUN-00');
OK, I worked on it, but I do not get good results when I do. I'm trying to compare data from two different connections to only return people with different numbers in "jobID".

In English, that's what I want:
All employees of A (which Active is 1), who are also in B (where End_date is NULL), where the JobID do not match.

If it should return:
100244
100526
100615
100989

But I was not able to find a way to get this result.

Thank you!

Michelle

Try

select *
  from datasamplea a
 inner join datasampleb b
    on a.employeenumber = b.employeenumber
 where a.active = 1
   and b.end_date is null
   and a.jobid != b.jobid;

Published by: Paul Horth on 3 may 2012 05:26

Tags: Database

Similar Questions

  • Bug: Cross connection request does not not in 3.1, 3.2.1

    Hello

    in {message identifier: = 10066256} I learned to use the cross of connection requests. In points 3.1 and 3.2.1 apparently no longer works? This feature has been removed or changed syntax?
    When I use an example that works in 3.0 I get that
    ORA-00900: invalid SQL statement
    cordially
    Marcus

    Thanks Marcus,

    Sorry, I was not back on the disabled extensions, when mentioned.
    The command of the BRIDGE has been developed for querying Oracle databases not to Oracle databases. That's why he lives in the expansion of migration.
    It works against two Oracle databases, but the database links may be more appropriate and supported by SQL * Plus and other tools.
    BRIDGE only works with SQL Developer.

    Anyway thanks for the update.
    Kind regards
    Dermot
    SQL development team.

  • How can I search for specific dat ramges in Windows 7

    Hi, I had to buy a new compuiter and it came with Windows 7 and I can't figure out where the comand of research is - I think that disappeared - and the search on the file header is not get everything I need.  I need to find, for example, all the files that I wrote in January 2008, which contains the word "Record".  Is it possible to download the XP: Microsoft's search engine and use in Windows 7? The XP search all done perfectly.   Let me know, Joe

    Hello

    References to Vista also apply to Windows 7.

    Windows Search does not work or research are slower
    http://support.Microsoft.com/GP/windows_search

    Troubleshooting Windows Vista search & indexing errors
    http://www.WinVistaClub.com/T24.html

    Reconstruction of the Index in Windows Vista
    http://www.howtogeek.com/HOWTO/Windows-Vista/rebuilding-the-search-index-in-Windows-Vista/
    How to enable or disable the search Index in Vista
    http://www.Vistax64.com/tutorials/69564-index-enable-disable.html
    Improve Windows searches using the index: frequently asked questions
    http://Windows.Microsoft.com/en-us/Windows-Vista/improve-Windows-searches-using-the-index-frequently-asked-questions

    ================================

    Tips for finding files
    http://Windows.Microsoft.com/en-us/Windows-Vista/tips-for-finding-files

    How to use advanced search in Vista Options
    http://www.Vistax64.com/tutorials/75451-advanced-search.html

    How to restore the page button on the Start Menu after installing Vista SP1
    http://www.Vistax64.com/tutorials/145787-Search-start-menu-button-restore-after-SP1.html

    How to restore the context Menu item search after installing Vista SP1
    http://www.Vistax64.com/tutorials/134065-search-context-menu-item-restore-after-Vista-SP1.html

    How to create a shortcut on the desktop search in Vista
    http://www.Vistax64.com/tutorials/126499-search-desktop-shortcut.html

    ----------------------------------------------------------

    Win Key F opens advanced search

    Searching in Windows Vista, part 1
    http://Windows.Microsoft.com/en-us/Windows-Vista/searching-in-Windows-Vista-part-1-secrets-of-the-search-box

    Part 2
    http://Windows.Microsoft.com/en-us/Windows-Vista/searching-in-Windows-Vista-part-2-Start-menu-and-control-panel-search-tips

    Part 3
    http://Windows.Microsoft.com/en-us/Windows-Vista/searching-in-Windows-Vista-part-3-using-advanced-search-for-those-hard-to-find-files

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • Slow down the search for the data source

    For j2me so Media Player I open a connection file (in a local file) and get an inputstream and passing to the player I have no problem loading the file/search.

    On the other hand, I wrote my own simple data source wraps simply a connection file and an Inputstream, when I try to read a large file the app just crashes. I think that what the Player tries to do is read the entire file for the headers, but why is there this difference in speed?

    NM, the reason why it was slow was because I was enveloping the stream in an input stream shared

  • Query to search for recursive data

    Hello
    I have a table called orders that has two columns, orderid and originalorderid. the data from this column as below:

    OrderId Active OriginalOrderId
    6 0
    11 6 0
    14-11-1

    I want to write a query such that when I pass the orderid = 14 it returns me OrderID 6 and 11 6 being the first orderid that changed 11 orderid, then 14 orderid.
    How can I write such a request.

    Please notify.

    Thank you
    Reena

    Hello

    @ Centinel: thanks for you Centinel SAMPLES.

    WITH orders AS
        (
                SELECT 6  AS ORDERID, 0  AS ORIGINALORDERID, NULL       AS ACTIVE FROM DUAL UNION ALL
               SELECT 11 AS ORDERID, 6  AS ORIGINALORDERID, 0          AS ACTIVE FROM DUAL UNION ALL
               SELECT 14 AS ORDERID, 11 AS ORIGINALORDERID, 1          AS ACTIVE FROM DUAL
        )           SELECT  max(ltrim(SYS_CONNECT_BY_PATH(ORDERS.ORDERID, ','),','))keep(dense_rank last order by level  )res
               FROM    ORDERS
               START WITH ORDERID != 14
               CONNECT BY ORDERID = PRIOR ORIGINALORDERID
    /
    RES
    --------------------------------------------------------------------------------
    11,6
    
    SQL> 
    
  • Search for GPS data in LR3

    I add GPS data to digital photos. At the moment I arrived to IDImager, which shows a Google Map, I do drag and drop photos on the map, and then click Save to update the GPS coordinates in the image. Then when I open the image in LR3, the geocoded data is there. Granted it is quite quick and simple, but I prefer to be able to choose a location on a map in LR3 and added GPS coordinates. I could not yet find out how. Is this possible in LR3?

    LR not have built in support (yet), but here is a plugin that you might want to check.

    http://regex.info/blog/Lightroom-goodies/GPS

  • Search for files in a folder by date range?

    Trying to sort through a few photos in a folder, all confusing to form various phones and cameras and their Photos for Mac app development.

    Is there a way to search for specific dates in some way, via a recommended application or something please? I am busy making albums, for example Christmas 2002, 2003 Christmas and if you are looking for the picture files that are in the range say December 20, 2002-January 2, 2003. They are all in different folders for the moment on an external drive, so scattered everywhere.

    Can anyone help please?

    Thank you

    If you import the photos into the Photo app, they sort by date.

  • How can I tell the mail client to search for new mail on the server?

    How can I tell the mail client to search for new mail on the server?

    Within the Mail app and display the Inbox you can pull down on the list of e-mail using your finger and you should see a small reel spinning gear. Which indicates that his check new email.

    You can also go into the settings of e-mail and calendars Contacts and view the settings there. Examine the settings of "search for new data. If the Push is enabled, then messages will be pushed to you if the email provider supports this feature. You can also set your accounts to use Fetch and set the frequency, he's going to go out and look for new e-mail messages.

  • Can RoboHelp9 search for information from another database outside himself

    Hi experts,

    I just got the task of studying the search function of the RoboHelp if she could meet our needs:

    We want to have a RoboHelp 9 to host the Center contact information, and we already have two or three other database exist for different departments that contact center agents could connect to search for information.

    the question is:

    1. is it possible, after RoboHelp 9 created and configured, agents can search and retrieve information not only reside in RoboHelp but is also in other databases?

    2 is it possible that the public internet users could search for and retrieve information located in RoboHelp and other databases (allowing us to go)?

    Thank you very much in advance,

    Fran

    Not sure you mean by your last paragraph - you can check the blog post described in the help article - http://iconlogic.blogs.com/weblog/2011/02/adobe-robohelp-9-external-content-search.html#tp

    It is pretty cool (I don't use it myself in my projects because many of our customers are small internet); you could also add URLS to the search pages from external sites (such as a knowledge base) and let users make their own additional research.

  • Search for all files? Search by creation date?

    How can I search within all files?  I know that the files are there and contain the words I'm looking for, but Windows cannot find them.  Some files do not have extensions, some have a .bak extension and some have various other extensions.

    Also, I see an option to search by modification date, but not created.  How can I search for all files on my hard drive, created on a particular date (including the .dll, .exe, etc..).  I'm trying to find all the files that were installed with an application.  The files have different change dates, but all have the same creation date (when the application has been installed).

    I do not understand how that returns results for all files (including non indexed files).  Can you please explain?

    The search interface has been simplified at the request of the overwhelming majority of users. Until a more sophisticated user, you liked the very high amount of control WHAT XP gave it. The new interface 7 has fewer orders. When the research opens, you will see an "additional search... "Computer" and other. Since you are obviously in control of syntax, the interface for non indexed opening files is quite simple. There is always the option to expand the index to include everything. (Control panel/Indexing Options)

    If your index still don't "look in" a file, you can try to assign an 'association' for the file type. I have no idea what the .xyz file type might have as a native association, but you can associate this notebook. (right-click, open with, choose default program..., see the box always 'use..')

    Messages rating helps other users

    Mark L. Ferguson MS - MVP

  • Search for a record at a later date

    Hello

    From this forum, I am able to solve little of my question but not always able to reach the conclusion.

    My requirement is to search the later date in the clob data type and then return records. Dates are available in the format YYYY DD Mon.

    In the example below, I just want these IDS when the variable 'text' contain later date that is available in the text date > current date

    Output must be ID 101, 102 because it contain date > current date

    ID 103 will not come as long as the date (November 19, 2014) < date current (November 20, 2014)

    with abc as

    (

    Select 101 as id, ' Prime Minister arrived in Melbourne for the last leg of his tour of four cities in Australia on March 1, 2014 and April 3, 2100 as the double data

    Union

    Select 102, "The 234/12 advance r1eading of Singapore December 1, 2012, for the third quarter on December 1, 2015, showing no response" of the double

    Union

    Select 103, ' there is no malaria symptom Minister after November 19, 2014 meaning vaccine properly work ' from dual

    )

    Select regexp_substr (data,'[(0123456789)] + [()] + ((Jan) |)) () Feb) | (Mar) | (APR) | (May). (Jun) | (Jul) | (August). (MS) | (Oct) | (Nov). (Dec)) [()] + [(0123456789)] +')

    ABC

    Suggestion:

    FUNCTION to CREATE or REPLACE makeDate (in_string in VARCHAR2
    in_format IN VARCHAR2: = "DD month YYYY")
    date of return
    IS
    BEGIN
    To_date (in_string, in_format) return;
    exception
    When others then return null;
    end;

    /

    WITH abc AS (SELECT 101 AS ID, 'Prime Minister arrived in Melbourne for the last leg of his tour of four cities in the Australia on March 1, 2014-3 April 2100' AS DATA FROM dual
    UNION
    SELECT 102, "The 234/12 advance r1eading of Singapore December 1, 2012, for the third quarter on December 1, 2015, showing no response" OF THE double
    UNION
    SELECT 103, ' there is no malaria symptom Minister after November 19, 2014 meaning vaccine properly work ' FROM DUAL
    UNION
    SELECT 104, ' there is no malaria symptom Minister after 19 Qur'an 2014 sense vaccine working properly ' FROM DUAL
    )
    , date (select id, regexp_substr (data, "([0-9] {1,2} [A-Z] {3} [0-9] {4})', 1, level, 'i'") datestring)
    ABC
    CONNECT PRIOR ID = ID
    AND PRIOR sys_guid() IS NOT NULL
    AND LEVEL<= regexp_count(data,'([0-9]{1,2}="" [a-z]{3}="">
    SELECT a.ID, a.data
    DATE d
    INNER JOIN abc A ON (A.ID = d.ID)
    where makeDate (d.datestring) > sysdate

    /

    Instead of having a WHEN and others-the function you * should * catch possible exceptions.

    I chose to build a to_date function to be able to continue in the case of a bad date.

    HTH

  • Connection verification failed for data source - mysql.jdbc.Driver

    I get this message when you try to add a mySQL (don't ask) database in CF Admin checking the connection failed for data source: shownets java.sql.SQLException: no suitable driver available for shownets, please don't check the configuration in the file resources, pilot error: com.mysql.jdbc.Driver


    The root cause was that: java.sql.SQLException: no suitable driver available for shownets, please don't check the configuration in the file resources, pilot error: com.mysql.jdbc.Driver I tried all sorts of messages instructions and nothing seems to work.  It's on my 32-bit platform. Tryng to get out all the bugs before I installed the 64-bit version.

    TNX a

    It seems that you have recently installed Coldfusion. I say this because recent versions of Coldfusion no longer ships with JDBC to MySQL driver. You must therefore download and install it yourself.

    To do this, go to the download page of the MySQL JDBC driver. Select the platform independent as a platform connector. Download the ZIP file independent of the platform mysql-connector-java - x.x.xx.zip. (x.x.xx represents the version number)

    Extract the ZIP file. Open the folder that results and search for the driver. It is a JAR file called mysql-connector-java - x.x.xx - bin.jar (x.x.xx represents the version number). Copy the file in the directory lib to Coldfusion.

    Restart Coldfusion. Voila - you're ready to go.

  • Search for photos by date?

    This seems an obvious thing to do, get my whole photo by date collection, for example date = 2015, but I can't find how to do it. Help, says there is a way, but does not show not what it is. Can someone help me?

    The photos are chronologically in the 'Photos' album, if you click the left arrow in the upper left corner of the screen, you can go to the display of "collections" instead of see 'moments', if you click on it again you will be taken to the view of "year".

    You can also type 2015 (for example) in the search field and find all your pictures with this date.

  • Search for the text value data store

    Hello, I have a PDO of data to store, and I would like to search for a text value in a quantity of measure.  In each of my test series, there is a quantity of measure with the name TCNAME and stores the cell name of test in the string format.  I would like to get all the TCNAMEs that contain "TC4" for example.  Currently, I have to load TCNAME in the portal and display it in an array of string.

    Any ideas how I can do this?

    I assume you are using a PUMA testbed that stores this kind of goods on a unique value chain chains.

    There is no direct search method, so I guess that a script is the only solution we can offer.

    Datafinder you can search for the minimum and maximum of a channel. That would be too much work in the store of ASAM.

    "PDO / cpp"
    protected tcnameMQs: set tcnameMQs = store. GetElementList ("MeasurementQuantity", "name = TCNAME", true)
    protected tcnameMQ: for each tcnameMQ in tcnameMQs
    MsgBox tcnameMq.References ("local_columns"). Elements (1). Properties ("values"). Value
    Next

    ' AOP5 / Corba
    protected tcnameLCs: set tcnameLCs = store. GetElementList ("LocalColumn", "measurement_quantity.name = TCNAME", true)
    protected tcnameLC: for each tcnameLC in tcnameLCs
    MsgBox tcnameLC.Properties ("values"). Value
    Next

    I have added the example which should be the shortest path from my point of view. In AOP5, you can search LocalColumn and spend BA which is less overhead.

    It is perhaps a good idea to post-processing of the data base and crush the decription "Test name" by

    "The test cell name == NAME. You can search not post-processed by Searchin' for.

    protected tcnameMQs: set tcnameMQs = store. GetElementList ("MeasurementQuantity", "description = name of the test cell", true)
    protected tcnameMQ: for each tcnameMQ in tcnameMQs
    tcnameMQ.Properties ("description"). Value = "name of the test cell is" & tcnameMq.References ("local_columns"). Elements (1). Properties ("values"). Value
    Next
    Store.Save

    Thereafter, you would be able to search for it.

    Greetings

    Andreas

  • What type of connections I do for the acquisition of data PCI 619 card pins? What I have to give it to the ground and the CCV on the pins of the connector myself? What should be the value of the SCR I need to give to the PIN?

    I have a PCI 6519 data acquisition card. I want to install it on the PC and use it outputs to control a robot. I have problems with the connections to the terminal block which is attached to the cable.

    What type of connections I do for the acquisition of data PCI 619 card pins? What I have to give it to the ground and the CCV on the pins of the connector myself? What should be the value of the SCR I need to give to the PIN?


Maybe you are looking for