Fix query to show what I want

Hello,
I'm using Oracle JDeveloper 11g Release 2 (11.1.2.3.0).
Here a little sample data:
create table Concessionaire (CON_ID number, CON_NAME varchar2(20));
create table Stock (STO_ID number, STO_CAR_ID number, STO_CON_ID number, STO_SALE_ID number);
insert into Concessionaire values (1, 'Con1');
insert into Concessionaire values (2, 'Con2');
insert into Stock (1, 1, 1, null);
insert into Stock (2, 2, 1, null);
insert into Stock (3, 1, 2, null);
insert into Stock (4, 1, 2, null);
Query:
SELECT Concessionaire.CON_ID,
       Concessionaire.CON_NAME,
       Stock.STO_CAR_ID,
       Stock.STO_CON_ID,
       Stock.STO_ID,
       Stock.STO_SALE_ID
FROM Concessionaire, Stock
WHERE ((Concessionaire.CON_ID = Stock.STO_CON_ID) AND (Stock.STO_SALE_ID IS NULL)
Match:
CON_ID     CON_NAME     STO_ID     STO_CAR_ID     STO_CON_ID     STO_SALE_ID
    1                Con1               1                   1                       1                      null
    1                Con1               2                   2                       1                      null
    2                Con2               3                   1                       2                      null
    2                Con2               4                   1                       2                      null
And I want that the same result but without the last line. If a concessionaire have in stock the same car two times, (same STO_CAR_ID, but different STO_ID) doesn't appear in the result.
Can someone help me with this query?
Thanks in advance!           

WITH T AS (
           SELECT  Concessionaire.CON_ID,
                   Concessionaire.CON_NAME,
                   Stock.STO_CAR_ID,
                   Stock.STO_CON_ID,
                   Stock.STO_ID,
                   Stock.STO_SALE_ID,
                   ROW_NUMBER() OVER(PARTITION BY Concessionaire.CON_ID,Stock.STO_CAR_ID ORDER BY Stock.STO_ID) RN
             FROM  Concessionaire,
                   Stock
             WHERE Concessionaire.CON_ID = Stock.STO_CON_ID
               AND Stock.STO_SALE_ID IS NULL
SELECT  CON_ID,
        CON_NAME,
        STO_CAR_ID,
        STO_CON_ID,
        STO_ID,
        STO_SALE_ID
  FROM  T
  WHERE RN = 1
    CON_ID CON_NAME             STO_CAR_ID STO_CON_ID     STO_ID STO_SALE_ID
         1 Con1                          1          1          1
         1 Con1                          2          1          2
         2 Con2                          1          2          3
SYS@orcl >
SY.

Similar Messages

  • I want to use some Greek letters.  I found the font "Symbols" which  shows what I want but I cannot print in it.  I can print in all the other fonts.

    I want to use some Greek letters.  I found the font "Symbols" which  shows what I want but I cannot print in it.  I can print in all the other fonts.  What can I do?

    To type Greek, go to system preferences/language & text/input sources and check the box for Greek, plus the box for Show Input Menu in Menu Bar, plus the box for Keyboard Viewer.  The select Greek from the "flag" menu at the top right of the screen and type.  Select Keyboard Viewer from the same menu to see which key does what.  Do not worry about the font, that is taken care of automatically.

  • Query to show what procedure isn´t assigned to any user!

    Hi all,
    I whant to know if anyone have a query that show all procedures from a specified user that is not granted the execute privilege to anyone!
    Tks,
    Paulo.
    i'm trying this one but don´t know if it is correct:
    select privilege, owner, table_name from dba_tab_privs
    where table_name not in (select object_name from dba_objects
    where object_type = 'PROCEDURE')
    and privilege = 'EXECUTE'
    and owner not in ('SYS','SYSTEM','XDB','DBSNMP','WMSYS')

    You can start to work with Pete Finnigan's script :
    http://www.petefinnigan.com/who_can_access.sql
    Nicolas.

  • Apple, please fix this bug.  Sending scanned images to "Pictures" is not what I want nor what I was able to do in every previous operation system.   I want to save all scanned items in a specific folder - NOT "PICTURES"  Please fix this bug NOW!

    Apple, please fix this bug.  Sending scanned images to "Pictures" is not what I want nor what I was able to do in every previous operation system.   I want to save all scanned items in a specific folder - NOT "PICTURES"  Please fix this bug NOW!

    I only use Image Capture, so I can't speak for other software.
    Here is how I select a Scan To destination:
    If you are using the minimal details screen, you should have the same submenu to the left of the page size.

  • Can i make a book in iPhoto without using any of the built in layout templates, which are too limiting when i have already cropped my pictures to show just what I want. Ideally I just want to drag and drop and arrange and size the pictures myself

    Can i make a book in iPhoto without using any of the built in layout templates, which are too limiting when i have already cropped my pictures to show just what I want. Ideally I just want to drag and drop and arrange and size the pictures myself

    If you have Pages you can create customs pages for your book as TD suggested. If you have Pages from iWork 09 or 11 this app will add 80 or so additional frames to those offered:  Frames and Strokes Installer. Don't use it on the latest Pages version, however.
    This tutorial shows how to create a custom page with the theme's background: iP11 - Creating a Custom Page, with the Theme's Background for an iPhoto Book.  Once the page is complete to get it into iPhoto as a jpeg file follow these steps:
    Here's how to get any file into iPhoto as a jpeg file:
    1 - open the file in any application that will open it.
    2 - type Command+P to start the print process.
    3  - click on the PDF button and select "Save PDF to iPhoto".
    NOTE:  If you don't have any of those options go to Toad's Cellar and download these two files:
    Save PDF to iPhoto 200 DPI.workflow.zip
    Save PDF to iPhoto 300 DPI.workflow.zip
    Unzip the files and place in the HD/Library/PDF Services folder and reboot.
    4 - select either of the files above (300 dip is used for photos to be included in a book that will be ordered).
    5 - in the window that comes up enter an album name or select an existing album and hit the Continue button.
    That will create a 200 or 300 dpi jpeg file of the item being printed and import it into iPhoto. For books to be printed choose 300 dpi.

  • I tried to open a folder in my Documents. It does not show in any window but does show up when I am half way between windows. It did the same thing when I tried to empty the trash. It asked if that was what I wanted but I could't say yes because it was or

    I tried to open a folder in my Documents. It does not show in any window but does show up when I am half way between windows. It did the same thing when I tried to empty the trash. It asked if that was what I wanted but I could't say yes because it was or

    what is your question/issue here? did the folder have any content in it to begin with? screen shots of what you may be seeing?
    if english isn't your native language, write it in what you are most comfortable speaking in to describe your issue.

  • TS3274 I get on the internet with my Ipad3 and when I start typing in the search box the ipad guess' what I want before I finish typing and goes to the internet. How do I fix that?

    I get on the internet with my Ipad2 and when I start typing in the search box the ipad guess' what I want before I finish typing and goes to the internet. How do I fix that?

    Yes if you purchase the tethering data plan for your iPhone. See:
    iPhone: System requirements for Personal Hotspot

  • I ordered a ringtone that came as a song and did not appear in a position to be added.  It did not show up but came through as a song and asking me to add it to a playlist.  This is not what I wanted to do and I promptly follow the prompt to "Buy"

    I ordered a ringtone that came as a song and did not appear in a position status to be added.  It did not show up but came purchased as a song and now asking me to add it to a playlist.  This is not what I wanted to do and I promptly follow the prompt to "Buy more options" to get what I thought was a ringtone.  Please help!

    The ONLY place to buy a ready made ringtones is from the iphone itself from the itunes app, then "More">"Ringtones"
    If you bought from your computer, then you need to create the ringtone.  You can create a ringtones from just about any song/sound file for free.
    Google will find several ways to do this.

  • When I'm previewing my iDVD, the pictures are all of the edited ones - which is what I want - but after I burn the DVD, all the pictures are in the unedited form!! What the heck?!! How do I fix this problem? I've never experienced this before!!

    When I'm previewing my iDVD, the pictures are all of the edited ones - which is what I want - but after I burn the DVD, all the pictures are in the unedited form!! What the heck?!! How do I fix this problem? I've never experienced this before!!

    Hi
    Try in iDVD
    • Save as a DiskImage
    • Play this by use of DVD-player tool
    Still OK or problems ?
    If OK - Burn it by use of
    • Apple Disk Util tool - or -
    • Roxio Toast™ (if You got this - I love it)
    Yours Bengt W

  • I don't know what happened to my iphone but for some reason, siri is talking to me now and I have to tap everything 3 times inorder for my phone to do what I want it to do. How can I fix this problem?

    I don't know what happened to my iphone but for some reason, siri is talking to me now and I have to tap everything 3 times inorder for my phone to do what I want it to do. How can I fix this problem?

    Hello, Alayah14. 
    Thank you for visiting Apple Support Communities.
    This sounds like VoiceOver has been enabled.  Here are the steps on how to disable this feature.
    iOS: Configuring accessibility features
    http://support.apple.com/kb/HT5018
    Cheers,
    Jason H.

  • What is this message, and how can i fix that problem? when i want to update or restore my cell, this message is coming: (An unknown error occurred (1480))

    What is this message, and how can i fix that problem? when i want to update or restore my cell, this message is coming: (An unknown error occurred (1480))

    I am getting the same error message. Have you figured it out?

  • When exporting from Photos, the panel for naming the file no longer shows up. Why and how do I change so I can name the file what I want?

    When exporting from Photos, the panel for naming the file no longer shows up. Why and how do I change so I can name the file what I want?

    You don't need to maintain all versions of the upgrade chain, but many of us do in case we need to work on a legacy file. If you want to rmove a version, though, ti should be done BEFORE installing the later one. Just reinstall CS5 and things should get back to normal.

  • ADF Bar Graph Series Rollover Hint :  show 3.000 and what I want is 3.

    I've got an ADF bar chart(JDeveloper 11.1.2.1.0), which it always show 3.000 and what I want is 3.
    My bar code as followed:
    <dvt:barGraph id="graph2" value="#{bindings.EmployeeVO2.graphModel}"
    subType="BAR_VERT_CLUST" animationOnDisplay="auto" threeDEffect="true"
    seriesRolloverBehavior="RB_HIGHLIGHT" partialTriggers="::graph1"
    dynamicResize="DYNAMIC_SIZE" inlineStyle="vertical-align:baseline;">
    <dvt:background>
    <dvt:specialEffects/>
    </dvt:background>
    <dvt:graphPlotArea/>
    <dvt:seriesSet>
    <dvt:series/>
    </dvt:seriesSet>
    <dvt:o1Axis/>
    <dvt:y1Axis/>
    <dvt:legendArea automaticPlacement="AP_NEVER"/>
    <dvt:y1TickLabel scaling="none" autoPrecision="off"/>
    <dvt:markerText>
    <dvt:stockVolumeFormat scaling="none" autoPrecision="off">
    <af:convertNumber type="currency"/>
    </dvt:stockVolumeFormat>
    <dvt:x1Format scaling="none" autoPrecision="off">
    <af:convertNumber type="currency"/>
    </dvt:x1Format>
    <dvt:y1Format scaling="none" autoPrecision="off">
    <af:convertNumber maxIntegerDigits="5" minFractionDigits="0"
    maxFractionDigits="0" minIntegerDigits="1"/>
    </dvt:y1Format>
    <dvt:zFormat scaling="none" autoPrecision="off">
    <af:convertNumber/>
    </dvt:zFormat>
    </dvt:markerText>
    </dvt:barGraph>

    Thanks all. The pie chart is pretty right already; I've used the sliceLabel and numberFormat to produce something that's pretty close as mentioned earlier:
    <dvt:sliceLabel>
    <dvt:graphFont color="#ffffff"/>
    <dvt:numberFormat
    scaleFactor="SCALEFACTOR_NONE"
    numberType="#{AdminCaseload.chartOptionAmountTypeInt}"/>
    </dvt:sliceLabel>
    ... but by using the managed bean to set the numberType to NUMTYPE_CURRENCY when $$ are charted, the rollover hint now displays as I want with the $, but the LD_PERCENT (default) slice labels over the chart are now displaying as $20% which seems a bit crazy. How can I show the currency symbol against the value in the rollover hint, without it appearing alongside the LD_PERCENT slice label in the chart?
    On the bar charts, what I need to be able to do is find an sliceLabel equivalent tag location for the numberFormat. You'd think it would be the dvt:y1Axis, given that it doesn't want to let you insert a numberFormat inside either the seriesSet or series tags. How do we control formatting of the value rollover hints on a bar chart ?
    Thanks in advance.

  • Iam using I phone 4s I want connect the wi fi. But once I entered the wifi password , it's showing dhcp boot static what I want to do

    Iam using I phone 4s I want connect the wi fi. But once I entered the wifi password , it's showing dhcp boot static what I want to do

    If your Wi-Fi router's DHCP is working, on iPhone select DHCP that's it.

  • What I want to do is to get the co-ordinates of the elements of the third array which shows differences between 2 other arrays

    Hello,
    Ive have got a vi that compares two arrays by element and gives back the location of the elements that are not equal in a third array. What I want to do is to get the co-ordinates of the elements of the third array from the either the first or second array.
    Many Thanks
    (Labview 7.1)
    Please find the vi attached below
    Attachments:
    ArrayDiff701.vi ‏25 KB

    jihn wrote:
    What I want to do is to get the co-ordinates of the elements of the third array from the either the first or second array.
    Sorry, I don't understand what you mean. What are coordinates in this context?
    If you for example want to get an array of all elements from the first array corresponding to the list of indices in the "locations" array, just add another FOR loop as shown.
    Your VI has a major flaw! You need to reverse the order of "Add array elements" and "to I32". The "to I32" needs to come first! (see image). If you "add" first, you'll run into problems if you have more that 32k different elements because of overflow in the I16 integer.
    Message Edited by altenbach on 02-21-2008 05:22 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Different.png ‏9 KB

Maybe you are looking for

  • Quark 7.5 Will Not Print In Snow Leopard

    I've been running my networked G5 (OS 10.4.11) for years with no problems using Quark, PhotoShop, Illustrator, etc. I recently bought a new iMac (OS 10.6.2) and migrated the G5 files to iMac. Worked through a few bugs and adjustments, however QuarkXp

  • Multiple Video Cards - 4 monitors

    I was wondering if there was anyone out there that has a successful installation of multiple video cards. i.e. 1 AGP with dual ports and a PCI with dual ports. I would like to run 4 22" monitors on a G4. Just want to know if there were any reccomenda

  • MacMini and software tryouts

    Hi! I am in the market for a new machine. I like the Mini, but i'd like to see how it behaves using an application that is very graphics intensive. More specifically, i'm talking about Second Life. Do you know if it s possible to go to an Apple store

  • Not burning DL DVDs

    Whether on internal drive or external drive with Toast 8 nor with burner on internal drive. Message: error on internal data transfer between computer and drive.

  • "Oracle11i financials-interview questions & Answers"

    Hi there, can anybody please provide me with interview questions and answers for oracle11i financials.(Functional/Technicals) modules: GL,AR,AP,FA, and Technicals thankign you, mail me at : [email protected] regards, muffaddal