SQL query to return only voided records unless they exists once

  • Hi

    i am running:

    PL/SQL Developer

    Version 9.0.4

    Oracle database 12C

     

    My issue is that i cant figure out how to make a query that will

    keep all the green records but exclude the red one,  we have had some unfortunate registrations in our DB so instead om people moving records they have used the V (S_code) wrongly.

     

    The above 2 labels look identical but they are actually different... i just didnt include the column that shows they are 2 different types.

     

     

     

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • This site is specifically for SQL Server (T-SQL).  I could tell you how to approach this in T-SQL, but I don't know whether that solution will translate to PL/SQL.

    The T-SQL solution is to use a ROW_NUMBER() such that voids are sorted last in their partition and to only display rows where the S_Code is not V or the row number is one.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply