Only Return the latest issue of a document

Hi all,
I am trying to work out a script to only return the latest issue of a document. In the example below if I was using the correct statement I would only return the issue 3 records (AAA and AAB)
I am not sure what syntax/operator to use, can anyone help me..
Document Issue
AAA 1
AAA 2
AAA 3
AAB 1
AAB 2
AAB 3
I have tried the group by expression and the MAX operator...... to no avail....

Is this what you need?
SQL> CREATE TABLE dt_test_docs (        doc_id varchar2(10),
  2                                                     ver number,
  3                                                     updated_by varchar2(10),
  4                                                     updated_timestamp timestamp
  5                                             )
  6  /
Table created.
SQL> INSERT INTO dt_test_docs
  2  VALUES('ABC',1,'user1',systimestamp-3)
  3  /
1 row created.
SQL> INSERT INTO dt_test_docs
  2  VALUES('ABC',2,'user2',systimestamp-2)
  3  /
1 row created.
SQL> INSERT INTO dt_test_docs
  2  VALUES('ABC',3,'user2',systimestamp-1)
  3  /
1 row created.
SQL> INSERT INTO dt_test_docs
  2  VALUES('ABC',4,'user3',systimestamp)
  3  /
1 row created.
SQL> INSERT INTO dt_test_docs
  2  VALUES('DEF',1,'user3',systimestamp-3)
  3  /
1 row created.
SQL> INSERT INTO dt_test_docs
  2  VALUES('DEF',2,'user3',systimestamp-2)
  3  /
1 row created.
SQL> INSERT INTO dt_test_docs
  2  VALUES('DEF',3,'user2',systimestamp-1)
  3  /
1 row created.
SQL> INSERT INTO dt_test_docs
  2  VALUES('DEF',4,'user1',systimestamp)
  3  /
1 row created.
SQL>
SQL> SELECT
  2     doc_id,
  3     ver,
  4     updated_by,
  5     updated_timestamp,
  6     max_ver
  7  FROM
  8     (
  9     SELECT
10             doc_id,
11             ver,
12             updated_by,
13             updated_timestamp,
14             MAX(ver) OVER(PARTITION BY doc_id) max_ver
15     FROM
16             dt_test_docs
17     )
18  WHERE
19     max_ver = ver
20  /
DOC_ID            VER UPDATED_BY UPDATED_TIMESTAMP                                                      MAX_VER
ABC                 4 user3      06-SEP-06 05.31.19.242000 PM                                                 4
DEF                 4 user1      06-SEP-06 05.31.19.304000 PM                                                 4

Similar Messages

  • How Do We Find the Latest Version of a Document without its Path?

    Does anyone know how to find the latest version of a document in iFS when you don't know the path of the document? I'm using a Selector to search iFS based on a search string for the object's title and am not sure how to find the latest version of the returned documents.
    Thanks for any help.

    If you can use the Selector to get the public object then you are in good shape. Once you have the public object recast it to a Family. The method getLatestVersion() will return the public object of the latest version.

  • HT1491 I purchased a year subscription for Huffington Post Magazine $19.99 and when I go to the Newsstand and try to read the latest issue it tells me I have to pay $0.99?

    I purchased a year subscription for Huffington Post Magazine $19.99 and when I go to the Newsstand and try to read the latest issue it tells me I have to pay $0.99?

    They are only free via the account orginally purchased or if they came pre installed on the computer. Depending on what you have purchased already us the one account for the app store - saves headace and hassel in the future thus not double buying software. Do you have iwork installed on your imac? meaning the iwork 09? if you do your should be able to to to the store and update it. Worked fine for me since i bought the DVD version of iwork 09 and Aperture 3. I did not want to have to rebuy them so the app store noticed i had them installed and changed the update via the app store.

  • After purchasing the Auto-Renewable subscription, the latest issue did not become available

    Hi, I have a problem with my app: After purchasing the Auto-Renewable subscription, the latest issue did not become available for download/reading.
    These are the steps I done:
    1. I selected one of the options for subscribe
    2. Gone through In App Purchase
    3. After going through the In App Purchase, app updates the library
    4. After updating the library, the latest issue, is not available for download. It still has "Buy" button
    The ios certificates seems ok (redone many times), same steps of other 3 apps I already done.
    The In-app purchase Product ID are the same in the iTunes Connect and in the app through Viewer Builder (latest version with v19 tools)
    In Adobe dashboard the shared secret are set properly, paywall disabled
    Somebody had the same problem and can help me? I don't know really what else I can do
    Thanks in advance

    Today in iTunes Connect create a new in-app and auto-renewable subscription with a new id, rebuild the app with v20 tools and the new in-app purchase ids, delete the free issue and the in-purchase issue in the adobe dashboard and upload from my original indesign files again (the free with date for pubblication yesterday the other with today date), tested all in the sandbox and... everything works fine, after the subscription purchase the button became "download". I was happy and I sent the new app to Apple again (fourth time) for the approval. After only few hours later Apple start the review (this was amazing because it usually takes at least 5 days). One hour later I receive the "reject" state again
    After purchasing the Auto-Renewable subscription, the latest issue did not become available for download/reading. Please see below for the steps to reproduce the issue:
    1. Launch app
    2. Tap Subscribe
    3. Select any of the options for subscribe, for example, 3-month subscription as shown in the screenshot 0496
    4. Go through In App Purchase
    5. After going through the In App Purchase, app updates the library
    6. After updating the library, the latest issue, in this case 327 - Maggio 2012, is not available for download. It still has "Buy" button as shown in the screenshot 0497
    Now the question is: why on my 2 ipads worked well but apple find again the same error?
    Where's the problem? I really need help from some Adobe experts, the "Gold support" don't really support me at all... I wrote a long email with all the details and the answer was one line and after my answer they disappeared ...
    In this case unpublish folio and change publication date manually from folio producer and then republish it.
    Please follow below link:
    http://helpx.adobe.com/digital-publishing-suite/kb/subscription-fail-ios-renditions.html

  • How can i get more than 100 email in Mail? I can only see the latest 100. I have an hotmail account and it worked at my other mac.

    How can i get more than 100 email in Mail? I can only see the latest 100. I have an hotmail account and it worked at my other mac.

    How can i get more than 100 email in Mail? I can only see the latest 100. I have an hotmail account and it worked at my other mac.

  • I show 3 versions of PS installed: PS CC, PS CC (64 bit) and PS CC (2014).  Can I just delete the 1st 2 and only keep the latest?

    I show 3 versions of PS installed: PS CC, PS CC (64 bit) and PS CC (2014).  Can I just delete the 1st 2 and only keep the latest?

    http://blogs.adobe.com/jkost/2014/06/installing-the-2014-release-of-creative-cloud.html
    -This messages says (at least some) CC 2014 programs use NEW plugins https://forums.adobe.com/thread/1499663
    -so do not uninstall the older CC programs if you use plugins in your programs until you are sure you have plugins that work in CC2014
    If you are sure you don't need the old CC programs
    -http://helpx.adobe.com/creative-cloud/help/install-apps.html to install or uninstall

  • Why when i save my indesign file down to an earlier version does it only save the first page of my document?

    why when i save my indesign file down to an earlier version does it only save the first page of my document?

    This forum is about the Cloud as a delivery process, not about using individual programs
    If you start at the Forums Index http://forums.adobe.com/index.jspa
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says ALL FORUMS) to open the drop down list and scroll

  • Search function only returns the first entryinstead of 2600

    Hi all,
    I am using JDNI to search in a iPlanet LDAP. This is the code:
    String filter = "(objectclass=TDC-Empleado)";
    NamingEnumeration resultados;
    SearchControls limitacionesBusqueda=new SearchControls();
    limitacionesBusqueda.setSearchScope(SearchControls.SUBTREE_SCOPE);
    results = ctx.search("o=TDC",filter,limitacionesBusqueda);
    I know with another tool that this filter works but the search function only returns the first entry!!!
    Somebody can help me ?
    TIA
    Manuel

    humm.
    Sets ctx.setCountLimit(long), or else checks the "size limit" of your iplanet server (size limit: number of entries returned to the client application).
    A.V.

  • HT1766 how to restore older backups? I can only access the latest backup but I need the one before that.

    How to restore older backups? I can only access the latest backup but I need the one before that.

    You would only have that backup if you saved it somewhere.
    Itunes only keeps the latest one.

  • Brother 2240 only printing the very beginning of any document, help!!!

    I have a Brother 2240 monochrome laser printer 3days new after my 2140 gave up the ghost. I use a wireless home network and the 2240 is connected over USB to an Airport Express. Consistently I have tried to print documents, pdfs, jpgs, pngs etc and the 2240 only prints an inch worth of the top of the page and pauses. I have the current 10.6 drivers and the printer has its latest firmware. Multiple computers on my network have had the same issue. If I clear the print queue and turn the 2240 off and on the same document will properly print. I'm at a loss on how to troubleshoot this one. Any help would be appreciated.

    Same problem here. I got the 2240 too, with the latest firmware and driver (using CUPS). When USB is connected straight to the printer, it works flawlessly, but the trouble comes around when its networked through the Airport. I find that it prints the first page fine and about the first couple centimeters of the second page before it pauses the print que. Only occurres on complex print jobs (lots of graphics or even some word docs with tables and clip art). So far I've had problems printing multiple page docs from Safari, Word, & Pages.
    2009 iMac, using 10.6.7, 4GB RAM

  • API search will only return the first 200 results????

    It seems that I can only retrieve 200 results when using doOracleSimpleSearch api call.
        osr = oses.doOracleSimpleSearch(strSearch, 1, 1000, false, false, true);
        nCount = osr.docsReturned;
        nCount2 = osr.resultElements.Length;
        nCount3 = osr.estimatedHitCount;nCount and nCount2 are both 200.
    nCount3 is 1332
    Ok, no problem. Even though I asked for 1000 results, I figure it will only return 200 at a time, so I write a simple loop.
       while (nTotalResults < nCount3)
          osr = oses.doOracleSimpleSearch(strSearch, nTotalResults + 1, 200, false, false, true);
          nCount = osr.docsReturned;
          nTotalResults += nCount;
       }After executing the search the first time, nTotalResults is set to 200, so I'm now requesting that the search starts at index 201 and to return the next block of 200.
    osr.docsReturned is now = 0
    stuck in infinite loop because it's not returning all my results.
    Update:
    It seems this is not just an API issue. If I do the search through the web interface, and go to page 20 (it's displaying 10 results per page) I see results. But as soon as I go to page 21, the page is blank even though it says there are over 1000 results.
    Edited by: JimG on Feb 15, 2012 5:17 PM

    You need to change the "Maximum Number of Results" from the Admin GUI.
    Go to Global Settings -> Query Configuration, and you'll find it there.

  • Process.exitValue() only returns the low byte of the exit code?

    Hi - I'm executing a subprocess and then waiting for it to return, and then examining the exit code of the subprocess. The error the subprocess returns is 0xb03, but exitValue() only sees 0x03. Further testing shows that if I return 0xbff from my native process, exitValue() or waitFor() will only return 0xff. I expanded this further to return 0xfffffbff, and sure enough, the Process methods only return 0xff.
    Anyone know what the deal is here? The return type for exitValue() and waitFor() are both 'int', so it seems reasonable to be able to return values up to 0xffffffff. Is there a way to set this up to sue the full int?
    Thanks for any insight.

    OK, that explains it. I think we had taken the fact that main() returns and int on *NIX that you could return anything that fit in an int into the exit code.  I've now found some corroboration that you can only return a value of 0-255.
    This also explains why we have never seen this issue on Windows - apparently you can return much larger values on Windows.
    Thanks for the assist!

  • All messages will only show the latest message received, but not the rest of the conversation until I send a response

    I'm having some issues with my messages, text and iMessage. When I receive a message it will only show the last one sent from that person, even if they have sent me multiple texts. I am then not able to see the rest of the conversation until I send a response back. Even then the message takes longer to send than when messages is working properly. I've tried resetting and restarting the phone and it is still doing the same thing. It has done this in the past and restarting the phone usually worked, but I recently did the latest software update and it is now doing this consistently. Anyone have any similar issues or ideas to maybe try and fix it?

    Hey Olivia,
    If you are having an issue with your iPhone only showing the most recent message of a conversation in the Messages application, and you have already tried restarting and resetting the iPhone, the next thing to try would be to back up any data on the iPhone, erase it and set it up as a new device. See this article for directions -
    How to erase your iOS device and then set it up as a new device or restore it from backups
    Thanks for using Apple Support Communities.
    Happy computing,
    Brett L 

  • The latest issue of Pages for iPad: 1. Very slow. 2. Late in reacting to typing. 3. When I go to a specific file, informs me that some images were deleted and therefore file has been changed. Then when OPEN option used, opens file slowly. Please, help!

    What I have to do to correct the following problems with Pages app. For iPad:
    Hesitates to display results of typing, some times for 5-6 characters;
    Very slow in opening files;
    Before opening of a specific file displays message: DOCUMENT DETAILS. SOME CHANGES WERE MADE TO YOUR DOCUMENT. SOME IMAGES ARE MISSING BECAUSE THEY WERE DELETED FROM YOUR DOCUMENT. We'll, nothing is missing. But it takes forever to open this file. The previous issue of Pages worked very good. But they would not let me to go back to it. Please, help!

    Tmobile did the exact same thing to me. So that is customer service at work in general. Nice try though lol.
    To the OP
    I see you said You paid for shipping, did you Insure it? Claim insurance on it. If you did not, It may not be Verizon or your fault in the sense of the phone not making it to the warehouse. There are people out in the postal world that will steal phones that are not insured. It could have been a Verizon employee, i suppose.
    But, if this was to be a bought in court, if you shipped it with out insurance, sadly your at fault.
    Do you still have the Serial number of your old phone? If so, you should be able to track where your phone is (if it is reported as a defect/damaged) If so, you may be able to use that as proof. If it does not show up as a defect or what ever they determine use as a loss, then you know it did not make it to the warehouse to be checked in. I would suspect Apple or Verizon could tell you what the Serial number came up as.

  • How to Delete the Latest Version of a Document

    Suppose i have a document A which has 3 versions, 1,2 and 3
    now i have to delete the 3rd version and make 2nd as the latest
    one. how to go about doing that??

    Are you sure? It seems that you could get the last version description and delete it with the free() method as follows:
    VersionDescription[] vds = IfsFileSystem.getHistory(po);
    // delete the last version
    vds[vds.length-1].free();

Maybe you are looking for