Help PLEASE, I think with MERGE--

Hi, am trying to update a table where the dates and IDs are 2 or more rows. What I'd like to do is, if date2 on row1 is within 24 hours of date1 on row2, then the date2(row2) updates date2(row1) and the row2 gets totally deleted (see merged result example below).
For example,
logid date1 date2
1111111 01/01/2007 01/03/2007
1111111 01/03/2007 02/15/2007
1111111 01/01/2007 02/15/2007 --- merged result
I've tried rowid's and rownums and merges, subqueries too, but I just don't thinkk I'm getting it right. Any help?
Thanks,
Chris Adams

Nicolas is unbeatable ;)
SQL> CREATE TABLE t (logid INTEGER, date1 DATE, date2 DATE)
Table created.
SQL> INSERT INTO t
     VALUES (1111111, DATE '2007-01-01', DATE '2007-01-03')
1 row created.
SQL> INSERT INTO t
     VALUES (1111111, DATE '2007-01-03', DATE '2007-02-15')
1 row created.
SQL> MERGE INTO t t1
   USING (SELECT ROWID,
                 logid,
                 date1,
                 date2,
                 CASE
                    WHEN date2 BETWEEN LEAD (date1) OVER (ORDER BY date1) - 1
                                   AND LEAD (date1) OVER (ORDER BY date1) + 1
                       THEN LEAD (date2) OVER (ORDER BY date1)
                 END x
            FROM t) t2
   ON (t1.ROWID = t2.ROWID)
   WHEN MATCHED THEN
      UPDATE
         SET date2 = t2.x
      DELETE
         WHERE date2 IS NULL
Merge successfully completed.
SQL> SELECT *
  FROM t
                                             LOGID DATE1     DATE2   
                                           1111111 01-JAN-07 15-FEB-07

Similar Messages

  • Help please.  Trouble with a table

    Hi All.  Hope you can help.  Looked through the Q & A but it's all about CS4 so no good to me as I have CS3.  I am new to DW and trying to start my site.  I inserted a table with 1 x row and 2 x columns.  I first made the left column 160 px wide, and the rest for the main body.  Inserted a graphic at the top of the left column to head the menu.  Then I tried to insert another graphic into the body (right column)  I could not place this graphic at the top because the cursor would only go half way down the image on the left.  I tried doing various things and one image would go up and the other down or vice versa.  It's driving me nuts :-))  Does anyone have any idea what I am doing wrong please?
    Also, does anyone know of a site where I can get good tutorials in CS3 please/, without it costing me a small fortune.  TIA
    Regards
    Jon

    With your cursor in the table cell, set the verical alignment to Top in the properties panel.  That will ensure that any images or text you place within that cell stays at the top no matter how the cell or table expands.
    And not to be disrespectul in any way, this is a pretty basic function of table layouts.  You are sure to run into many more troubles along the way unless you study up on tables and how they work in DW.  So instead, I agree with the above response - you're going into a learning curve anyway, so you may as well apply it to CSS - I think things will even go quicker for you that way and you'll be building sites using the current and better technology.

  • Help please? problems with screen resolution & external monitor

    had a look around this forum and seen many questions about screen resolution when connecting to an external monitor but unfortunately, non that help me answer my problem.
    got a brand new macbook a few months ago and today bought a HP v220 22" external monitor.
    I am new to the idea of external monitors and am unsure what i am doing wrong settings-wise. it seems that no matter what resolution i set either my macbook display, or the external monitor display to. the external monitor is still not sharp.
    Im not sure how to explain what i need but basically i need it to be so that things appear on the external the same size as they do on my macbook screen, so that i will have more space to work in on my external monitor (i am a graphics student) but at the moment what appears on the monitor is lieterally just a magnified version of my macbook screen, hence it lacks clarity.
    the highest resolution offered in the menu for my macbook screen is 1280x800 and my external is recommended to be set at 1680x1050.
    what settings should i have to get the resolution right?
    i will be so so grateful if you can help. i think ive tried every single display setting but to no avail. so please help me!

    The 13.3" screen on the MacBook running at 1280 x 800 will have a ppi (pixels per inch) of around 113. A 22" monitor running 1680 x 1050 will have a ppi of around 90. So it is natural that it will look magnified compared with the MacBook. The two displays have different a pixel pitch.
    Since there are no monitors with ~113 ppi out there in the market, what you want to do with having the same size and sharpness between the MB and a monitor will not be possible.
    If you ran the MB's screen at 1024 x 640 (not even sure if that is an available choice), then the two screens would match in terms of "magnification." But the MB isn't going to look very sharp running such a low, non-native format.

  • HELP PLEASE - Still struggling with 3-5 minute boot times - Neo4 SLI

    Okay, I THOUGHT my computer was "locking up" after the "DMI Pool" meesage on about every other boot.  The fact is, it may have never actually locked up, I just thought it did whe it just needed more time.  I've read about possibly trying to roll back my NVidia ATA drivers, but Windows says there are no drivers to roll back to.  Could someone tell me where to get alternative drivers?
    Better yet, could someone tell me what I'm doing wrong to get this LOOOOOOONNNNNGGGG Boot time?
    By the way, I have tried going with just one SATA, I've tried two, I've tried a PATA drive alone, and I've tried all three.  No help
    (I'm a newbie here, but I THINK my system specs will show up below in my signature.  If not, I'll follow up in a reply messagewith the specs.)
    PLEASE HELP!
    Thanks for reading - thanks even more if you can help.   

    1) Quote
    Lite-On CDRW
    seems common. Check that your optical drives are correctly jumpered (master/Slave). The Nvidia ATA drivers require this & don't like CS(cable select) which some drives are set to. if in doubt check the manufacturers site for the jumper settings.
    2) if there is room have the optical drives on seperate ide channels. again if moving them update jumper positions if necessary.
    3) If all else fails change Ata drivers to the Nicrosoft ones.
    In device manager :-
    Click update driver on the Nvidia Pata driver tab in properties.
    Choose install from a specific location
    Select dont choose , i will choose the driver
    Then select standard dual channel pci controller which is the XP 1
    luck

  • Help Please!  working with avi files.

    I need to import an avi file (320 x 240) into FCP 3. The clip will be composited with a title that was originally in eps format which I have converted into a PSD file.
    When I put them on my sequence it both need rendering. I have adjusted my sequence settings to match the files but still rendering is necessary.
    The avi properties are:
    320x240
    30 fps
    6.8 MB / S
    Alpha : none/ignore
    Composite: normal
    pixel aspect: square
    Compressor field is blank
    Sequence Settings are:
    320x240 Multimedia (large)
    30 fps
    Data Rate field is blank
    Alpha field is blank
    Composite: normal
    pixel aspect: square
    Compressor: DV/DVC Pro - NT
    The PSD file also needs rendering to view. This is when they are just individually side by side on the timeline, not even stacked above one another. How can I get both the avi file and PSD file to play without rendering?
    My deadline for this intro clip is tomorrow and I need help quickly!

    I was going to wait till you bumped your post again.
    Don't do that.
    Please.
    There are dozens of AVI codecs that have been obsolete for ten years and even more that never made it to the Macintosh. QT may or may not be able to open them. If you can play them, export from QTP to conventional DV and bring the newly created copy of the movie into a conventional DV sequence in FCP. There are other AVI conversion utilities.
    bogiesan

  • BT box wiring! (Help please , bank hol with no int...

    Hi, wonder if anyone can help ...
    anyone able to advise what the wiring sequence should be on my BT open reach box?
    It looks like there is a blue (A) and white blue (B) cables connected to the internal A/B connectors, but where do these corresponding cables then connect into? There appears to be two options - either they connect to the A/B connectors on the plate that fits onto the main box or they connect up to the 2 / 3 / 5 connectors on the rear of the faceplate - anyone got any ideas?
    Solved!
    Go to Solution.

    the lay across the terminal and then 'punched' in with an IDC tool  often they are plastic 
    If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post.
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • HT201263 Help please! Problems with iPhone 4 after iOS 6 upgrade

    Tried to upgrade iPhone. Got a message saying settings were lost, connect to iTunes. I did this and it said I had to restore. I did this and it said unable to restore due to unknown reason. Now phone keeps trying to upgrade and then restarts. iTunes doesn't recognise my phone.
    I have tried all troubleshooting tips and nine work!
    Please help!!

    same here..it doesnt work for me too!!
    exactly same issue. Apple got something wrong with iOS 6

  • Help please ~ sound problems with menus in iDVD

    I launch iDVD from within iMovie. Then I start to personalise the menus.
    But the menu screens although showing the chapters only give a loop duration of between 00:00 and 13:30 seconds.
    Every time whenever I import QuickTime dv. files (made in iDVD 5 to avoid the dreaded rise in volume at the end) the sound in iDVD is grotesquely distorted.
    Each of the QuickTime dv. movies last 10 seconds.
    I don't know what I'm doing wrong! Please help!!

    Thanks John Beatty of Maryland for responding. But I think I'll need to post my question again in hopes that someone else will recognise my difficulty.
    I was hoping for a solution.
    The distortion in audio occurs during the process of DESIGNING my DVD ~ I don't get as far as previewing.
    It's only occurring in one screen (or menu). Although my QuickTime dv. file lasts only 10 seconds (in this case) and should therefore fit within a 13 and a half second limit, it shouldn't be offering me such a short time frame ~ normally it's quite a bit more ~ 51 seconds, is it? ~ and you move the slider back to the time you require for the dv. movie to loop.
    But thanks anyway, John. Someone else might recognise my difficulty.

  • Help Please! -- issue with Mad Catz controller

    Can anyone help me out here? I have a Mad Catz Wireless PC Con and I'm having trouble getting it to work. After plugging it into a USB port, when I go to the System Profiler and go to the USB section, the PC Con is listed as hooked up to the USB port like it should be, so I know the computer is reading it properly, but I can't get it to work. When I open the apps I want to use it with, the buttons don't do anything. The obvious reason for this would be that the PC Con isn't compatible with those applications, but that's not the issue here because I have an application (USB Overdrive) that allows joysticks (or controllers or whatever) to be set up to work with any application, and this always worked for me perfectly when I had Tiger. With Tiger I used to use the PC Con with the emulator applications all the time, but now that I've upgraded to Leopard, nothing happens when I hit the buttons. There were no decent instructions with the PC Con. Is there anything I need to to do install the controller first before I can use it or something like that? Does anyone have any ideas for me? Any help is greatly appreciated. Thanks alot.

    In your Preferences menu, Type section, what Text Engine Option have you chosen?
    -Noel

  • HELP PLEASE n97 connectivity with pc

    Hi.I just got an n97 and i'm trying to connect it with ovi suite to restore my security copy but it doesn´t work.
    It says that my device is connected in the file transfer mode but I choose pc suite mode on the phone all the time...
    I have restarted the pc and the n97 and it's always the same.
    when i go to connection wizard it says that he can´t connect to do all that stuff I already did...however  my computer detects the phone without problems and the files appear in 'my computer'
    What should I do?

    buxi07 wrote:
    ALSO ADD I AM ALSO INTERSTED IN N900 BUT I WANT MY DEKSTOP VERTICALLY AND I THINK IT DOSN'T ROTATE VERTICALLY CAN U TELL ME ALSO THAT THE LATEST FIRMWARE CAN MAKE N900 TO ROTATE VERTICALLY? IS THERE IS AN ACCELARATOMETER IN N900?
    Currently, I believe the N900 operates in tablet mode landscape and phone mode only in portrait.  Like the missing MMS feature, maybe Nokia may be able to fix this in a later firmware update.  I read somewhere that they were more recently working on software stability and performance.  New features were definitely for a later release, which personally, is the best philosophy in my mind.  I think they had their fingers burned by the N97.
    EDIT:  Just read the specs and I didn't see a mention of an accelerometer in the N900 so from that I can't assume it has one.  http://maemo.nokia.com/n900/specifications/
    Message Edited by matt_t on 30-Sep-2009 06:40 PM
    Nokia N8 on O2-UK
    Firmware 022.014

  • Help please! Issues with Superdrive.

    I was ahving huge issues with my MBA these past days. Now I was able to boot with the OS X dvd and reinstall the OS. the installation went well, but now I have an eject symbol in the upper right corner of the system bar and it seems my USB port is either fried or locked. I can not use any other USB devices (wanted to hook up to my external HD to backup all my stuff and then zero out my MBA and clean install). its strange. I can restart the MBA pressing C and then the Superdrive runs. Guess this speaks against the USB port being fried.
    Would appreciate any help given soon!!

    Sorry if this is too basic and you have tried it but here goes:
    to eject the superdrive select the icon for it on the desk top (with the s-drive connected) then press and hold down the eject button on the keyboard upper most right on keyboard.
    You may even need to have the disc in the drive but I doubt that.
    Or go to iTunes or Finder, select the drive and eject from there.

  • Help please - at least with question on sound c

    <FONT color=#000080>I want to put together a multimedia PC (if possible at all) with the following abilities:
    <FONT color=#000080 size=2>Want to be able to play music CDs on PC hooked to a stereo system ? a sound card with 2 analog outputs connected to an integrated amp, but also want to be able to play DVD movies with 5. sound ? connected to an A/V receiver ? would Audigy 4 Pro or Audigy 2 ZS Platinum Pro do the job here? How would it connect to A/V receiver?
    <FONT color=#000080 size=2>Burn quality (emphasis on quality) music CDs and movie/music DVDs with dual layer capability, must be able to read them in other CD and DVD players ? would Plextor PX-76AL do the job? Any other recommendations?
    <FONT color=#000080>And would the same DVD dri've do the job of burning and reading DVD? Should get another one? What about progressi've scan?
    <FONT color=#000080 size=2>How to bring video to TV, what video card would do the job, something with DVI? Any recommendations?
    <FONT color=#000080 size=2>Though in a few games (decent graphic).
    <FONT color=#000080 size=2>What motherboard/PCU would be needed here?
    <FONT color=#000080 size=2>Finally, any recommendations for stores in GTO or on-line stores that would put something like this together?

    Good point on CPU and heat generation, but can I really save so much and lower the noise, other components still need to be cooled down?
    And water cooling would be probably way to expensi've.
    BTW, I already have a specific components list, runs arround 2K Canadian.
    Does anyone think this is overkill for the purpose (hook-up to HT system and listen to CD, listen/watch DVD)?
    ASUS P5GDC DELUXE MOTHERBOARD LGA775 INTEL 95P DDR2 DDR PCI-E6 2PCI-E 3PCI SATA RAID 000LAN SOUND
    INTEL PENTIUM 4 530J 3.0GHZ LGA775 800FSB MB CACHE 90NM HT PROCESSOR
    SAMSUNG 52MB DDR2 MEMORY PC2-4200 240PIN DIMM
    SOUND BLASTER AUDIGY 2 ZS PLATINUM PCI W/ INTERNAL PANEL
    LEADTEK WINFAST PX6600GT TDH 28MB DDR3 28BIT PCI-E VGA DVI HDTV-OUT VIDEO CARD
    PLEXTOR PX-76A 6X8X6 DVD+-RW 4X DVD+R DUAL LAYER DRIVE IDE W/ SW
    MAXTOR DIAMONDMAX 0 300GB HARD DRIVE 7200RPM 6MB CACHE 9.3MS SATA FDB
    THERMALTAKE SOPRANO VB000BWS BLACK ATX CASE 3 CASE FANS 4X5.25 2X3.5 5X3.5INT NO PS W/ WINDOW
    FORTRON FSP/SPI AX500-A 500W ATX2V 2.0 24PIN BLUE STORM POWER SUPPLY W/ 20MM FAN
    LOGITECH LX 300 CORDLESS DESKTOP WIRELESS KEYBOARD & OPTICAL MOUSE SET USB/PS2

  • HELP PLEASE - WHATS WRONG WITH THIS CODE

    Hi. I get this message coming up when I try to compile the code,
    run:
    java.lang.NullPointerException
    at sumcalculator.SumNumbers.<init>(SumNumbers.java:34)
    at sumcalculator.SumNumbers.main(SumNumbers.java:93)
    Exception in thread "main"
    Java Result: 1
    BUILD SUCCESSFUL (total time: 2 seconds)
    I am not sure whats wrong with the code. Any assistance would be nice. The code is below.
    package sumcalculator;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SumNumbers extends JFrame implements FocusListener {
    JTextField value1;
    JTextField value2;
    JLabel equals;
    JTextField sum;
    JButton add;
    JButton minus;
    JButton divide;
    JButton multiply;
    JLabel operation;
    public SumNumbers() {
    SumNumbersLayout customLayout = new SumNumbersLayout();
    getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
    getContentPane().setLayout(customLayout);
    value1.addFocusListener(this);
    value2.addFocusListener(this);
    sum.setEditable(true);
    value1 = new JTextField("");
    getContentPane().add(value1);
    value2 = new JTextField("");
    getContentPane().add(value2);
    equals = new JLabel("label_1");
    getContentPane().add(equals);
    sum = new JTextField("");
    getContentPane().add(sum);
    add = new JButton("+");
    getContentPane().add(add);
    minus = new JButton("-");
    getContentPane().add(minus);
    divide = new JButton("/");
    getContentPane().add(divide);
    multiply = new JButton("*");
    getContentPane().add(multiply);
    operation = new JLabel();
    getContentPane().add(operation);
    setSize(getPreferredSize());
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public void focusGained(FocusEvent event){
    try {
    float total = Float.parseFloat(value1.getText()) +
    Float.parseFloat(value2.getText());
    sum.setText("" + total);
    } catch (NumberFormatException nfe) {
    value1.setText("0");
    value2.setText("0");
    sum.setText("0");
    public void focusLost(FocusEvent event){
    focusGained(event);
    public static void main(String args[]) {
    SumNumbers window = new SumNumbers();
    window.setTitle("SumNumbers");
    window.pack();
    window.show();
    class SumNumbersLayout implements LayoutManager {
    public SumNumbersLayout() {
    public void addLayoutComponent(String name, Component comp) {
    public void removeLayoutComponent(Component comp) {
    public Dimension preferredLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    Insets insets = parent.getInsets();
    dim.width = 711 + insets.left + insets.right;
    dim.height = 240 + insets.top + insets.bottom;
    return dim;
    public Dimension minimumLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    return dim;
    public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    Component c;
    c = parent.getComponent(0);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+48,128,40);}
    c = parent.getComponent(1);
    if (c.isVisible()) {c.setBounds(insets.left+256,insets.top+48,128,40);}
    c = parent.getComponent(2);
    if (c.isVisible()) {c.setBounds(insets.left+408,insets.top+48,56,40);}
    c = parent.getComponent(3);
    if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+48,152,40);}
    c = parent.getComponent(4);
    if (c.isVisible()) {c.setBounds(insets.left+128,insets.top+136,72,40);}
    c = parent.getComponent(5);
    if (c.isVisible()) {c.setBounds(insets.left+248,insets.top+136,72,40);}
    c = parent.getComponent(6);
    if (c.isVisible()) {c.setBounds(insets.left+368,insets.top+136,72,40);}
    c = parent.getComponent(7);
    if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+136,72,40);}
    c = parent.getComponent(8);
    if (c.isVisible()) {c.setBounds(insets.left+176,insets.top+48,56,40);}
    }

    Thank you. How do i amend this? I have defined value1though.Yes, you did - but after the call to addFocusListener(...). It needs to be before it.
    BTW, you did the same thing with "value2.addFocusListener(this)" and "sum.setEditable(true)" on the next two lines. You're attempting to call a method on an object that doesn't exist yet (i.e., you haven't called new yet).

  • Help please , screen problem  with my 2GB ipod nano

    Hello guys
    A month ago i had to change the battery for my ipod , after that eveything worked fine for awhile then the screen was half blank and half i can see the menu, so i thought its a problem with the screen to i odered another one , and when i installed it , the ipod turn on and the pc can recognize it , but there is noting come up on the screen , just the background light, but noting on the screen , not even the mac logo.
    anyone know whats why this ?
    i hope i can find a solution here
    thanks

    i tried the restore 3 times and noting happened ,, the restrart , it never work with me ,not sure if the wheels working fine or whats wrong

  • Help Please file association with Cloud PS

    I am on a PC - Windows 7
    I recently upgraded fro PS 5.5 to Creative Cloud PS 14.0.2 x64
    I went in to associate my file types to open with the new version of PS
    I go into the proper sub directory (CC) and find the .exe file
    When I click on it it associates the file with my old version of PS.
    I'd appreciate any solutions.
    Thanks in advance.
    BZ

    The association can break when uninstalling an older version after installing the upgrade. It may be easier to just run the installer so that it will create the association. Normally this is a simple process, but Adobe is using a small program that controls the associations.
    Something else to try, open bridge and look in the preferences and see what the associations are set to there. I don't know if that affects that small app or not, but you could rule it out.

Maybe you are looking for

  • Create a file

    Hi, I just would like to create a file, which the user can download. Scenario: The user choose some options on the JSF-page. Then a database query will execute. The user should be able to download that data of the query as a .csv file. So how should

  • FTP Connection Problem

    Hai, I have a jsp code to upload files through ftp server , i use commons.net.ftp package to connect. I tried to connect to the local ftp server from a remote (tomcat )host and it worked, but when i hosted the jsp file from the local tomcat server it

  • Problems with CC logging me out and not syncing

    Every morning now when I come into work I find I've been logged out of CC This has two affects: No. 1 it didn't sync my files last night so I couldn't do the work I wanted to and No. 2 I have to agree with the licence agreement for each app in turn e

  • Where is Your To Do List Sync?  It's in Leopard! (Sticky Please)

    It's all here. http://www.apple.com/macosx/leopard/features/mail.html The update mail application for Leopard is going to have integrated notes and to do lists. You are already using a preview version of the notes. But to get them to sync back would

  • Boyum External Launcher Passing Database Information w/Multiple Parametes

    I have a Boyum button which calls a .NET application passing multiple parameters.  However, I need to add an additional parameter that passes the database name.  Can someone show me the correct syntax to do so? Thanks in advance.