Find a UNIQUE RECORD on both sides

Hi, I want to find a unique record that is either A or B who wants to tell A NOT IN B & B NOT in one, here is the sample data

A side
-----------

A_SUB_NUM        B_SUB_NUM        START_DATE_TIME         SIDE
88912345        88912345           20120625000031         A
77777733        77777733           20120625001608         A
77777733        77777733           20120625000000         A


B side
-----------

A_SUB_NUM     B_SUB_NUM        START_DATE_TIME    SIDE
88912345      88912345         20120625000022      B
88912345      88912345         20120625000028      B
88912345      88912345         20120625000031      B
77777733      77777733         20120625001607      B
IF the START_DATE_TIME differ in 1 second, they are considered the same record, example: 77777733, 77777733, 20120625001608 in one hand is the same as 77777733, 77777733, 20120625001607 B side

Here is my code, however it didtn give me the expected result that 88912345 have not been filter :(

(
SELECT  
START_DATE_TIME
,A_SUB_NUM
,B_SUB_NUM
,SIDE
FROM TEST_A t2
WHERE (A_SUB_NUM, B_SUB_NUM ) NOT IN 
(SELECT A_SUB_NUM, B_SUB_NUM FROM TEST_B
where (
start_date_time > to_char(to_date(t2.START_DATE_TIME,'yyyyMMddhh24miss')-60/86400,'yyyymmddhh24miss')
and start_date_time < to_char(to_date(t2.START_DATE_TIME,'yyyyMMddhh24miss')+60/86400,'yyyymmddhh24miss')
)
)
)

UNION ALL

(
SELECT 
START_DATE_TIME
,A_SUB_NUM
,B_SUB_NUM
,SIDE
FROM TEST_B t1
WHERE (A_SUB_NUM, B_SUB_NUM) NOT IN 
(SELECT A_SUB_NUM, B_SUB_NUM  FROM TEST_A
where (
start_date_time > to_char(to_date(t1.START_DATE_TIME,'yyyyMMddhh24miss')-60/86400,'yyyymmddhh24miss')
AND start_date_time < to_char(to_date(t1.START_DATE_TIME,'yyyyMMddhh24miss')+60/86400,'yyyymmddhh24miss')
)
)
)

This is the result from the query

START_DATE_TIME     A_SUB_NUM     B_SUB_NUM     SIDE
20120625000000     77777733         77777733       A


Expected result should be
START_DATE_TIME     A_SUB_NUM     B_SUB_NUM     SIDE
20120625000000     77777733         77777733       A
20120625000022     88912345         88912345       B
20120625000028     88912345         88912345       B
Here is the data dictionary
CREATE TABLE TEST_A
(A_SUB_NUM VARCHAR2(50),
 B_SUB_NUM VARCHAR2(50),
 START_DATE_TIME VARCHAR(50),
 SIDE VARCHAR2(2)
 );

CREATE TABLE TEST_B
(A_SUB_NUM VARCHAR2(50),
 B_SUB_NUM VARCHAR2(50),
 START_DATE_TIME VARCHAR(50),
 SIDE VARCHAR2(2)
 );

INSERT INTO TEST_B
VALUES ('88912345'    ,  '88912345'     ,    '20120625000022', 'B');
INSERT INTO TEST_B
VALUES ('88912345'    ,  '88912345'     ,    '20120625000028' , 'B');
INSERT INTO TEST_B
VALUES ('88912345'    ,  '88912345'     ,    '20120625000031', 'B');
INSERT INTO TEST_B
VALUES ('77777733'    ,  '77777733'     ,    '20120625001607', 'B');


INSERT INTO TEST_A
VALUES ('88912345'    ,  '88912345'     ,    20120625000031, 'A');
INSERT INTO TEST_B
VALUES ('77777733',  '77777733',    20120625000000, 'A');
INSERT INTO TEST_B
VALUES ('77777733'    ,  '77777733'     ,    20120625001608, 'A');
Appreciate your help :)

Hello

First of all, I want to note that there is a typing error in the last one you gave instructions insert. Instead of INSERT INTO TEST_B
VALUES ('77777733', '77777733', 20120625000000, ' A'), you probably want to post INSERT INTO TEST_A
VALUES ('77777733', '77777733', 20120625000000, ' A') and also instead of INSERT INTO TEST_B
VALUES ('77777733', '77777733', 20120625001608, ' A'), you probably want to post INSERT INTO TEST_A
VALUES ('77777733', '77777733', 20120625001608, ' A').

Here is a solution to your problem:

select * from test_a;

A_SUB_NUM                                          B_SUB_NUM                                          START_DATE_TIME                                    SIDE
-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----
88912345                                           88912345                                           20120625000031                                     A
77777733                                           77777733                                           20120625000000                                     A
77777733                                           77777733                                           20120625001608                                     A    

select * from test_b;

A_SUB_NUM                                          B_SUB_NUM                                          START_DATE_TIME                                    SIDE
-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----
88912345                                           88912345                                           20120625000022                                     B
88912345                                           88912345                                           20120625000028                                     B
88912345                                           88912345                                           20120625000031                                     B
77777733                                           77777733                                           20120625001607                                     B    

select *
from test_a
where   not exists (select *
                  from test_b
                  where abs(to_number(test_b.start_date_time) -
                            to_number(test_a.start_date_time)
                            ) <= 1
                    )
union
 select *
from test_b
where   not exists (select *
                  from test_a
                  where abs(to_number(test_a.start_date_time) -
                            to_number(test_b.start_date_time)
                            ) <= 1
                    ) ;

A_SUB_NUM                                          B_SUB_NUM                                          START_DATE_TIME                                    SIDE
-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----
77777733                                           77777733                                           20120625000000                                     A
88912345                                           88912345                                           20120625000022                                     B
88912345                                           88912345                                           20120625000028                                     B    

Tags: Database

Similar Questions

  • HP Officejet Pro 8620: One side scanning instead of both sides

    Whenever we scan with the printer using ADF, ALWAYS scan both sides of the document. We want to scan only ONE side, but we cannot find any setting switching on both sides for only one party to scan. It's very frustrating because whenever we scan, we have the right page and one white. We use Adobe Acrobat and driver scan TWAIN of the model.

    Is it possible to set up the printer we want?

    Best,

    JM

    Hi @keyser2015,

    Welcome to the HP Forums!

    I see you try to do a side scan instead of the two sides, with your HP Officejet Pro 8620 on Windows 10. And I'm happy to help you!

    Each scanning program, has their own features. I'm not familiar with the use of Adobe Acrobat, so it is possible the functionality are not available in this particular scanning program. If you need help on the use of Adobe Acrobat, I would say to contact our Support from Adobe, for assistance.

    In the meantime, I suggest try using HP Scan instead and see if the option is available on the main screen to choose scan front side. If you have trouble with the HP scanning program, please try our HP print and Scan Doctor, to see if it can automatically solve the problem for you!

    Hope this information is useful and thanks for posting!

    "Please click the Thumbs up icon below to thank me for having responded."

  • Printing one or both sides of the paper

    I have a new Officejet 6500 has more all-in-one printer with the ability to print on both sides of the paper.  It is configured to print on both sides right now, and I want to be able to change the setting for single side or double side easily, if needed, but I can't find instructions on how to do it.  I tried clicking on 'options', 'preferences', 'properties' etc etc but nothing seems to give me the option to select single or double sided.  How can I do?  Advice please.

    Thanks Bob.  I already found a solution - there is a drop down window below the line in preferences menu that says "print on both sides", and if you select 'none', it gives unique back.  Not really intuitive, but I was given this information by another computer geek and it works!  Thanks for getting back to me well.

  • HP Officejet 4630: Printing on both sides, no option to turn off when you print a Word Doc; When printing Pages

    Recently, when printing, the printer appear uses both sides of the paper, even when we don't want him. There is no option to turn it off when you print a Word document.


    When printing Pages it shows a checked box that says BOTH SIDES, if I uncheck, then it works.

    But from Word, there is no other choice. I tried the file/Preferences, I tried through the printer settings and nothing we can find will solve this problem? This has recently (last week or two) become a problem...

    Thank you!

    Hello @LaylaWi,

    Welcome to the Forums of HP Support!

    I would like to help you to solve the problem of double-sided printing that you experience when you try to print single-sided computer Mac OS X 10.9 to your HP Officejet 4630 e-all-in-one printer today. Please follow the steps below to disable duplex printing.

    1. Open a Word document
    2. Select file , and then click print
    3. Click on the drop down menu to the Copies and Pages and modify this provision
    4. Uncheck duplex .
    5. To change the additional print settings click on view details.

    -Source

    Ultimately, judging by the useful screenshots that you included in your post, you are in the right place to disable two-sided. You just need to click on the Copies & Pages for the appropriate options.

    Please reply to this message with the result of your troubleshooting. Good luck!

  • Want 5660: Printing on both sides of a sheet

    I love the ability to print on both sides of a sheet of paper.

    I know that if I have a document that has multiple pages in can I print every 2 pages on a single sheet.

    What I have is several files, each a page definition, but I would like to select, say, 2 files and say: "Print on both sides" and it would print the first file on the file 1 and the 2nd side on side 2.

    > >... What I have is several files, each a page definition, but I would like to select, say, 2 files and say: "Print on both sides" and it would print the first file on the file 1 and the 2nd side on side 2...

    Each file you want to print, the printer driver generates a print job that is sent to the printer.

    The printer interprets the content of the print job and prints the requested page or images, then (at the end of the work), all incomplete pages are printed and emptied of memory.

    If the next job always starts on a new sheet of paper, regardless of the setting, simplex / duplex.

    The only ways you could accomplish what you want are:

    • Find someone to write you a customized printer driver who would take the content of the two source documents offered as input to produce a single output print job; even if you could find someone to do this, it would probably cost more than the printer (or several of these printers).
    • Merge documents two sources (Word, Excel) entry in a new source document, then print it.

  • Not printing on both sides

    After that my last windows update, my printer does not print double-sided.
    I already reinstalled the printer, which is currently installed with the name of the driver HP Officejet 7610 Series class, even though it is an Officejet 7612.

    The printer works, but it is not printing on both sides.

    What can we do?

    @HenriqueCanada

    Check this duplex is enabled:

    Control Panel > display icon > devices and printers > right click on the printer >

    Printer properties > ( generaltab: change properties) >

    the device settings tab > next to automatic duplex printing: select installed > OK

    When you see a post that will help you,

    Who inspires you, gives a cool idea,

    Or you learn something new.

    Click the 'Thumbs Up' on this post.

    Fixed / responded? Click this post accept as Solution to help others find answers.

  • How can I create my own template pages, to print a 4-page newsletter on both sides of the tabloid-size paper?

    How can I create my own template pages, to print a 4-page newsletter, using both sides of the tabloid-size paper?

    The finished newsletter should be a folded booklet: a piece of 11 x 17 paper folded to form a 8.5x11 "booklet". This clearly means pages 1 and 4 should be printed on one side of the tabloid sheet and pages 2 & 3 on the other.

    I can't find such a model in the Pages.

    There is no such a model, so you'll have to make your own, using a spread on presentation of your newsletter.

    Use shapes, images and text boxes to position available for your model.

    You didn't say what version of Pages that you are using but if it's Pages 5.x, it has no text boxes related so this will make it difficult and it's going to be a lot of manual work.

    Peter

  • Print on both sides of the page

    For printing on both sides of the page, the instructions say to FLIP on LONG EDGE or RETURN on SHORT EDGE.   WHAT WOULD BE THE CRITERIA FOR THE REVERSAL OF ONE WAY OR THE OTHER?  I'm printing docs on 8-1/2 x 11 paper. 1 set of docs is 14 unique pages that I could turn it into 7 if I could print on both sides.

    Instructions more tell - printer is will automatically load the back paper to print on the other side. Someone please help me understand these instructions?  Thank you.  Judy

    > to FLIP on LONG EDGE or RETURN on SHORT EDGE.

    This difference is important if you want to print portrait vs landscape.

    For the first case, you usually run flip on the long side, on the side.

  • ENVY 120 CZ022B: How to print a word document on both sides of the page (MAC)

    How to print a word document on both sides of the page (MAC) I can´t find how do!

    Hello
    Follow these steps to automatically print double-sided in Word print jobs:

    In the file being used to print click the file menu and select print.
    NOTE: The print window might be minimized. Press show details to show all available print option.

    Click Copy Pages & drop doen and select layout.

    Set the duplex option as the binding edge (Portrait) Long or short edge (landscape) bond.

    You can save the settings for later use by clicking preset > save current settings as preset. By default, a used preset will remain until another preset will be used.

    Kind regards
    Shlomi

  • OfficeJet Pro 8610: Scanning both sides of the computer does not not on officejet pro 8610

    Hello

    Help, please!

    Set up: Officejet Pro 8610 connected wireless for HP laptop Windows 10.

    Mission: I have 10 A4 sheets with stuff on both sides. I want to scan every 20 faces and save them on my laptop in the right order.

    I would like to do this automatically thought IE the automatic document feeder.

    I use scan options HP Scan and Capture software in document settings

    I select the source to be "heavy feeder" and duplex scan (if available) option I select '2 Facer.

    Although this force the 8610 take the original since the ADF doc it's only one side.

    That's the problem!

    Also if I use the HP Officejet Pro HP printer Assistant, if I select the radio button for the front and back, once its done scanning side 1 of the document it asks me to take the originals and put them in the feeder to make the other side. The scans are then coming out in the wrong order!

    I bought this printer so I could do it, but can't make it work. I want to cry. Help, please.

    Thank you

    Hello

    The HP Officejet Pro 8610 does not support scanning duplex automatic, that the more advanced of this series models supports a such (8620 & 8630 models)

    You can find the printer specifications listed below:

    Breeze through multipage documents with automatic two-sided scanning and the 50-page auto document feeder (for 8620/8630 only).
    

    http://www.HP.com/hpinfo/newsroom/press_kits/2014/OJPro/OfficejetPro8610_8620_8630.PDF

    You can only perform this manually with your printer model, I suggest to use the HP scanning software.

    If the analysis is delivered in the wrong order, try to install and use the HP extended Scan application and check differences:

    FTP://FTP.HP.com/pub/scanners/HPScanExt/HPScanExt.msi

    Hope that helps,

    Shlomi

  • OfficeJet 6500 a: how to adapt a HP Officejet 6500 has so we can print on both sides

    Hello dear hp team

    I have a HP Officejet 6500 has more that color print on both sides.

    Now, I have only a 6500 a which initially can print one side.

    I changed the room in the back (I put the piece of the 6500 has more printer) so that mechanically, he has the ability to print also the two sides.

    Now how do I program the printer so that it detects that he now has the ability to print on both sides?

    Thank you for your reply and sorry for my English mistakes.

    A student of the Swiss school.

    Hello

    As suggested in the post above, only available for the printer manual duplex printing.

    The accessory of the duplexer is designed only for he 6500 more than model a, it is not intended and cannot be used with the model 6500 a, as you can find below:

    Suitable only for HP Officejet 6500A Plus e-All-in-One Printer - E710n
    

    http://support.HP.com/emea_middle_east-en/product/HP-OfficeJet-6500A-e-all-in-one-printer-series---E710/4083974/model/4083869/document/c02492482/

    Shlomi

  • Print on both sides?

    I would like to print both sides of the pages, but the "two parts" button is dimmed. I use the printer Deskjet 3050 J610 with OS 10.7.2. I checked to make sure I have the latest version of the driver.

    Can anyone help?

    Hello

    The two sides button is grayed until the button supposed to provide two-sided automatic printing, which is not supported by your printer,

    Below you can find the instructions manual Duplex, using the odd / even method:

    http://support.HP.com/us-en/document/c00294482

    In addition, you can use the face printing software two:

    http://FTP.HP.com/pub/softlib/software12/COL35975/MP-88750-2/HP_Two-sided_Printing.dmg

    You can access this tool by clicking the PDF button at the bottom of the print dialog box, and then select double-sided printing and follow the on-screen instructions.

  • I have a printer of good wanting more hp6500a how to print on both sides, and after the return to a single.

    Please note that I have Windows 7, thanks for your help.

    y.b

    Hello

    You can find detailed information on how to print on both sides paper for your product here:

    http://support.HP.com/us-en/document/c02773085

    I hope this helps.

  • Message of "Print on Both Sides" HP laserjet p1102w

    My hp laserjet p1102w suddenly started flashing a blue message "print on both sides" when I try to print a single document from the front.  After that I closed the window, it prints some kind of test page. How can I stop?

    Hello

    Here are the steps to disable manual duplex printing on this printer

    Start > Control Panel > devices and printers, right click on the printer icon

    Printer properties > device settings tab > Duplex mode > uncheck the manual duplexing option allow > apply > OK

    I hope this helps...

    Although I am an employee of HP, I speak for myself and not for HP.

    * Say thank you by clicking on the "Bravo!" Star"located on the left *.
    Make it easier for others to find solutions, marking my answer to "Accept as Solution" if it solves your problem.

  • I can't print on both sides!

    Hello

    I have the printer for 5 months and I've been printing with the unit duplex - two-sided printing option.

    A few days ago I tryied to print as usual on both sides of the page and I can not turn 'ON' the option for using the option two faces.

    I'm on mac and I tried to restart the printer and follow instraction on HP - the guid line, re - install the duplexer and it still does not.

    It is the copy of the scren on my mac:

    What option I have?

    I bought this printer just because both sides option.

    I still have my warranty on the printer and it's the priner info:

    Please let me know.

    Thank you

    Yotam Saban

    Hi Yotam,

    If please try following the steps below and check if this can help:

    1. check that duplex printing accessory has been installed correctly. To check this open system preferences and go to Print & Fax. Open the print to your printer queue. Click Printer Setup and in the tab menu choose driver. Make sure that the box next to HP printing accessory (duplexer) sides.

    2. on the file menu, select print. The print window is displayed.
    NOTE: The print window might be minimized. Click the blue triangle next to the name of the printer or on the button view details to see all the available parameters.

    3. in the print window expanded you will find next to Copies the checkbox for duplex. Select the check box.
    NOTE: If the check box does not appear in the specific application print dialog box, skip this step.

    4. to select the connection type click the selection box below, listed as the name of the program (e.g. TextEdit)
    Will appear as Copies & Pages within Microsoft Office applications.

    5. Select the menu drop down.

    6. set the duplex option as binding edge Long (Portrait) or binding Long Edge (landscape).

    You can save the settings for later use by clicking preset > save current settings as preset. By default, a used preset will remain until another preset will be used.

    Hope that helps,
    Shlomi

Maybe you are looking for

  • Accidentally deleted bookmark.

    Trying to find a bookmark I must have accidentally deleted. Can't remember the name, so need to see a history of deletions of bookmark.

  • Photos no longer synchronize with the iPad

    I can are no longer synchronized pictures opening with my iPad (s). I selected several albums opening of synchronization when it is attached to iTunes on my Mac. All other items will be synchronized (music, movies, etc.), but the pictures never compl

  • Portege R830 - Eco and other buttons do not work after installing Win7

    After a reinstall of windows 7, eco, presentation buttons, and one to stop the trackpad is not working, I reinstalled all the drivers, VAP button assistance program. Could someone with a R830 she me wich programs is the link in "support button" and i

  • Watch for the education shop

    I want to buy watch education channel. But I don't have a reduction, what is right, what should I do to receive cheaper?

  • OR USB-6009 and Tek TDS2024C comparesment

    My apologies if this topic was already discussed, but I searched through the forum and manuals and can't find anything. I have a problem with measurements in parallel with TDS2024C NI USB-6009 and Tek. I measured the noise high frequency on 10 s wind