Where am I wrong, subquery

I want 2 check which develop the amount not received order
and display the name of the provider and and the corrsponding PO_no.
I am able to get the individual totals like this;
purchase Ordered QTY
select SUPL_name, POh_no, sum(POd_qty) POqty
from PURCHASE_order_header,PURCHASE_order_detail,SUPPLIER_master
where POh_code = POd_POh_code
and  POh_no = POd_POh_no
and  POh_party_code = SUPL_code
group by SUPL_name, POh_no;

SUPL_NAME                          POH_NO      POQTY
------------------------------ ---------- ----------
SUPL 3                                  1         85
SUPL 2                                  2        200
SUPL 5                                  3        170

Goods Received QTY
select SUPL_name, GRNh_PO_no, sum(GRND_QTY_RECEIVED) GRNqty
from GRN_TXN_header,GRN_TXN_detail,SUPPLIER_master
where GRNh_code = GRNd_GRNh_code
and GRNh_no = GRNd_GRNh_no
and  GRNh_party_code = SUPL_code
group by SUPL_name, GRNh_PO_no;

SUPL_NAME                      GRNH_PO_NO     GRNQTY
------------------------------ ---------- ----------
SUPL 3                                  1         70
SUPL 2                                  2        130

i want to make a query that would calculate the balqty (po_qty - grnqty) and if greater 
than 0, then the query should return the supl_name, po_no, balqty in this fashion

SUPL_NAME                          POH_NO      balQTY
------------------------------ ---------- ----------
SUPL 3                                  1         15
SUPL 2                                  2         70
SUPL 5                                  3        170 

i tried something like this, but i dont know the query did not 
return the balqty (170) for supl5, poh_no 3;

SQL> select h.SUPL_name, h.POh_no, (h.Poqty-d.GRNqty) balqty
  2  from (
  3  select SUPL_name, POh_no, sum(POd_qty) POqty
  4  from PURCHASE_order_header,PURCHASE_order_detail,SUPPLIER_master
  5  where POh_code = POd_POh_code
  6  and  POh_no = POd_POh_no
  7  and  POh_party_code = SUPL_code
  8  group by SUPL_name, POh_no) h,
  9  (
 10  select SUPL_name, GRNh_PO_no, sum(GRND_QTY_RECEIVED) GRNqty
 11  from GRN_TXN_header,GRN_TXN_detail,SUPPLIER_master
 12  where GRNh_code = GRNd_GRNh_code
 13  and GRNh_no = GRNd_GRNh_no
 14  and  GRNh_party_code = SUPL_code
 15  group by SUPL_name, GRNh_PO_no) d
 16  WHERE h.poh_no = d.grnh_po_no(+);

SUPL_NAME                          POH_NO     BALQTY
------------------------------ ---------- ----------
SUPL 3                                  1         15
SUPL 2                                  2         70
SUPL 5                                  3             <-- ??
Please any1 can correct the above query
TYVM
(h.Poqty-nvl (d.GRNqty, 0))

Tags: Database

Similar Questions

  • menu of hyperlink is displayed when text is selected, not when the Menu item is selected. And of course does not display the available links. Where I'm wrong?

    Try to make hyperlinks in a menu item. If I select the menu item, the menu of hyperlinks is not displayed in the menu bar. If I click on new and then the tex in the link is selected, the hyperlink menu appears but the drop down menu does not offer the available links. Where I'm wrong?

    I think you use a menu by default on the page?

    It's design of menu by default, because they are already linked with the respective pages that you can't change.

    You can try to create the menu manual.

    Thank you

    Sanjit

  • How to define a WHERE clause of the subquery in a bean managed?

    Hi people,

    is it possible to define the place where clause of a subquery in a bean managed?
    For example, it is more SQL charly:

    SELECT * FROM
    (SELECT Person.Name
    OF the person)

    To change or add a WHERE clause, I use following code for the 'viewObject: view

    String whereClause = "ROWNUM < =: numberOfRows;
    viewObject.setWhereClause (whereClause);

    viewObject.defineNamedWhereClauseParam ("numberOfRows", null, null);
    viewObject.setNamedWhereClauseParam ("numberOfRows", new Number (100));

    AttributeList myattr = this.getNamedWhereClauseParams ();
    viewObject.setNamedWhereClauseParams (myattr);

    For example, this code works well for the first SELECT statement limit the output to the first 100 results. But how do I add a WHERE clause of the subquery in a managed bean? For example, when I want to limit the names of people that begin with the letter "A"?
    The query should look like this:

    SELECT * FROM
    (SELECT Person.Name
    OF the person
    WHERE Person.Name LIKE 'A %')

    Anyone know more?

    Thank you!

    Put a variable binding in your query, something like:

    where (: bv is null) or (xxx love: bv)

    John

  • Updated AIP player 2015 where have I wrong?

    I'm updating an agreement in principle to 2015 of player. I get "the upgrade patch cannot be installed by the Windows service install because the program to be upgraded is may be missing, or the upgrade patch may update a different version of the program...".

    Here are the steps that I followed, failure occurred in step 5.

    1. downloaded the base version exe ftp://ftp.adobe.com/pub/adobe/reader/win/Acrobat2015/1500630033/AcroRdr20151500630033_MUI.

    2. extract "< path to the folder where the file > \AcroRdr20151500630033_MUI.exe ' - sfx_o '< path to the folder where the files should be extracted >' - sfx_ne

    3 do run: msiexec /a "< path of the folder that the files were extracted in the previous step > \AcroRead.msi" TARGETDIR = "< path to AIP >.

    4 downloaded from this location was last updated ftp://ftp.adobe.com/pub/adobe/reader/win/Acrobat2015/1500630198/AcroRdr2015Upd1500630198_M UI.msp

    5 do run: msiexec /a "< AIP path created in the previous step > acroread.msi ' / p ' < path to the folder where the update file > \AcroRdr2015Upd1500630198_MUI.msp.

    I guess I use the wrong file base or the bad update, but I couldn't find anywhere how a figure this.

    Can anyone identify the mistake? Sorry if the question was asked several times before.

    Thank you very much.

    Actually, after several days, I found the answer. I tried to do it on a computer that has Adobe Reader is already installed. As soon as I took it, the steps above worked.

  • To a new PC in Acrobat Standard 10: where am I wrong?

    I downloaded the installation of Acrobat Standard 10 version.  The version on my old PC has been registered, so I tried to enter the page "Registered products" in S/N, but the installation routine would not accept.  Any ideas?

    Hi lizsteichen,

    Please let me know the version of the operating system installed on your previous & new computer?

    Your part XI CS Acrobat or was it an individual Installer?

    Also, let me know the exact error message?

    Check your serial key by using this link to quickly find your serial number.

    Kind regards

    Nicos

  • could someone please tell me where I'm wrong... ??

    with these parameters, I created a file pfile

    db_name = omf

    instance_name = omf

    control_files = / U01/OMF/Create/control01. CTL, /u01/omf/create/control02.ctl

    shared_pool_size = 100 m

    db_cache_size = 52 m

    DB_BLOCK_SIZE = 8192

    audit_file_dest = / u01/omf/adump

    background_dump_dest = / u01/omf/bdump

    = core_dump_dest / u01/omf/cdump

    user_dump_dest = / u01/omf/udump

    db_recovery_file_dest = / u01/omf/flash_recovery_area

    db_recovery_file_dest_size = 2g

    db_create_file_dest = / u01/omf/create

    db_create_online_log_dest_1 = / u01/omf/create

    db_create_online_log_dest_2 = / u01/omf.

    UNDO_MANAGEMENT = auto

    undo_tablespace = undotbs01

    Remote_login_passwordfile = exclusive lock

    compatible = 10.2.0.1

    After that, I started my database until the nomount State by specifying the path to my file pfile

    After that, I hit my database command to create as

    SQL > create database;

    It gives me error as

    ORA-01092: ORACLE instance is complete. Disconnection forced

    anyone please help me with this...

    Change undo_management from AUTOMATIC to MANUAL

  • I try to install the drive on a Mac. When I press on install, I see an installation message failed. Where I'm going wrong?

    I can't install the player on my Mac. When I press on install, I see an installation message failed. Can wher I go wrong?

    Hi flynavy,.

    Restart your Mac, try again to download & install Reader using this link Adobe - Adobe Acrobat Reader DC Distribution.

    Kind regards
    Nicos

  • Where I'm going wrong with the object Type

    Hello world
    I am trying to insert data into a table using a type of object
    Here is my code
    Please help me where I'm wrong...
    Thank you

    Code for the object. Type
    create or replace type emp_rec_type as object 
    ( empno number
     ,name varchar2(20)
     ,salary number(7,2)
     ,job varchar2(10)
     ,hiredate date
     ,commno number(7,2)
     ,deptno number(4));
     
    Now I want to insert data into the table like this
    begin
      insert into emp5 values(emp_rec_type(5,'jack',1000,'salesman','12-apr-2000',300.00,20));
    end;
    I don't want to create a variable of the object... Initialization type I want to create just to insert the value using the default constructor.

    Concerning
    Prost

    You can create the table of the object:

    create table emp5 of emp_rec_type;
    

    Kind regards
    Sayan M.

  • Movie in itunes, only itunes store link will wrongly

    I had some problems with my xps dell 10 64-bit windows.

    1 white horizontal lines appear when scrolling on main screen with selected movies.

    2. the links to select a movie go to a different movie. If displays the links are placed where the image wrongly.

    I already removed itunes and reinstalled.

    I'm having the same problem. By chance, do you understand how to solve the problem?

  • Smartphones from blackBerry Curve 8520 - Blackberry MAPS - how/where can I configure the GPS signal?

    I took a brief look at the questions on the CARDS, but none of these go to the ART GPS end does not. (I'm sure it's somewhere in the support forums, but I found nto).

    I have the icon of the WAP on my Blackberry Curve 8520. But when I click it I don't see is a grid nd no card. I checked Options Options/Advanced/cards and it is said by default Blackberry MAPS Service - EU. I also checked the place settings and under GPS Data Source it comes up with a list of all my contacts id bluetooth I suspect this is where it goes wrong, but I can't be sure.

    How can I put the correct GPS data source. How/where can I set this up please. ???

    Thank you

    JJ

    Any other ideas as to why the Blackberry connects sometimes to devices and sometimes does not. I saw him sign for a brief moment especially for my GPS dongle. Then fell to new. The signal on the dongle seems it continues to blink.

    When I take my BB in my car it instantly takes the car blue tooth

    Don't understand why he doesn't connect properly on my GPS unit now.

  • Where can I submit my character PS folder to help fix the head to the body?

    I'm working on a character, but the head will not attach to the body.
    I'm not sure what I'm doing wrong.
    I sized the character until about 2 MB photoshop file.

    Is there a place I can download for you guys can tell me where I'm wrong?

    Thank you very much! I saw all the videos to youtube and am a big fan!

    If you could upload it to a place like Creative Cloud, Dropbox, Google Drive, etc.-, I would be happy to take a closer look. Glad to see that the videos are useful.

  • CS6 Installation downloads will no where

    I need installation help. My updates of the CS6 creative cloud app did not exist and they advised me in another post on the first try, you rename a file, and then, if it does not have to uninstall and reinstall.

    Name change didn't solve the problem, so I disabled and uninstalled my CS6 application. Now I try to install, download 2 files, (Photoshop_13LS16.exe) and (Photoshop_13LS16.7z). After a double click on the file (.exe), it takes about 2 minutes. extraction of the files while displaying the normal progress bar, it 100% extraction of the file and then nothing happens.

    The other file, (Photoshop_13LS16.7z) opens to other folders, of which none seem to be executable exception and error .exe file this file.

    Any ideas where I'm wrong? Usually the installation is easy and runs on its own.

    Thanks, Larry

    The Adobe CS 6 folder created on your desktop? If so, open it and check if the setup.exe file is located inside?

    If possible, after the screenshot of the content of the Zip file.

  • I want to re install with a clean sheet. I have install, but my old catalog loads again. How do I delete catalog and where it is stored. I lost some of the media that came with my drive by accident so I need to re install

    I want to re install with a clean sheet. I have install, but my old catalog loads again. How do I delete catalog and where it is stored. I lost some of the media that came with my drive by accident so I need to re install

    HI ATR

    Just update you 13 windows 7 items... I sat until midnight and found the program data and ended up finding the catalog. I deleted the catalog now. and uninstalled items 13. I hope that when I reinstall it will be like new, and I can go back again. I had messed up I saw when viewing the photos in the media, it was media files and thought they shouldn't be there so I deleted them. Maybe thinking about now I get an error. Before, I made a slideshow with the media from the drive. I just started using elements 13 I used windows live previously for videos. Can you let me know also what photoshop elements or first, you use the most.  Also if I import video files in why do I see them I think of thumbnails. That's where I went wrong and thinking, they shouldn't be here. I brought a few books and trying to go through the learning process. What camera do you use?  Many questions sorry. Thanks for any help.  Russell

  • Global Application contexts - where to set the identifier of the customer?

    Hello



    I try to use contexts of global application in the context of an implementation of fine-grained access control.
    It is an e-Business Suite environment, more precisely of CRM, is a multilevel environment.
    Users access the two screens and OA framework based forms.

    I think I need to use the global application contexts because users can have multiple database sessions.
    In addition, all users login using the same database connection account.

    As much I can define a unique identifier for a user who persists throughout all their sessions I do use set_context settings, username and client_id below: -.


    DBMS_SESSION.set_Context (namespace = > 'XXUOM_CONTEXTS',)
    attribute = > "EXEMPT_FROM_VPD_POLICIES"
    VALUE = > l_exempt,
    username = > USER,
    client_id = > pi_user_id);


    The problem I have is to find a suitable place to set the client identifier.

    I don't know if the value is to be eliminated by another code or if the value is not used in all sessions.


    I use: -.


    DBMS_SESSION. Set_Identifier (pi_user_id)


    The tables that I call after insert triggers either icx_sessions or fnd_logins.


    However, the identifier of the customer is always null when I question him within the application, through: -.


    SELECT SYS_CONTEXT ('USERENV', 'CLIENT_IDENTIFIER') of double


    If I put the value via a rule of customizing a form, the value remains.




    I would be very happy if someone can advise me on where I'm wrong.




    Andy

    Thanks a lot for the pointers. Add DBMS_SESSION. SET_IDENTIFIER (FND_GLOBAL. User_name) does the work.

    Good.

    I want to say that this is the solution to my problem, but I am hesitant on the change in package FND_GLOBAL that there is no guarantee that it will not be overwritten by Oracle as part of a future patch/upgrade.

    It is not supported and it will be overwritten for sure.

    The patch proposed in [ID 1130254.1] is no longer exists.

    Log an SR to get this fix (or a replacement).

    Thank you
    Hussein

  • What is wrong with my code?

    I have one site in simple I need checked because the images are not displayed when he spotted in a browser.  I also tried to use Adobe service to preview it online and the images do not appear there either.  I don't know what I'm doing wrong so please check this code and see if you can tell me where I'm wrong:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="en">
      <head>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
        <title>
          Nature
        </title>
              <style type="text/css">
              a:hover { text-decoration: none !important; }
              .header h1 {color: #e0d5b6 !important; font: bold 22px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 24px;}
              .header p {color: #a89458; font: normal 16px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 16px; }
      
              .content h2 {color:#66572a !important; font-weight: bold; margin: 0; padding: 0; line-height: 30px; font-size: 17px;font-family: Georgia, serif;}
              .content p {color:#5f5a4b; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;}
              .content a {color: #7c5d00; text-decoration: none;}
              .footer p {
              margin: 0;
              padding: 0;
              text-align: center;
              color:#c0c0c0;
              font-family: Georgia, serif;
              font-style: italic;
    }
              .footer a {color: #efd78f; text-decoration: none; border-bottom: 1px dotted #af8505}
              .notice p {margin: 0; padding: 0; text-align: center;color:#ffffff; font-family: Georgia, serif;}
              .notice a {color: #efd78f; text-decoration: none; border-bottom: 1px dotted #efd78f}
              </style>
      </head>
      <body style="margin: 0; padding: 0; background: #ae8306;" bgcolor="#ae8306">
                <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%" style="padding: 10px 0 35px;background: #ae8306 repeat-x center top;">
                        <tr>
                      <td align="center" style="padding: 15px 0 10px; font-size: 11px; color:#ffffff; margin: 0; line-height: 1.2;font-family: Georgia, serif;" valign="top" class="notice">
                                            <p style="margin: 0; padding: 0; text-align: center;color:#ffffff; font-family: Georgia, serif;"><singleline label="Title">You&#39;re receiving this newsletter because you signed up at yoursite.com or bought widgets from us</singleline></p>
                                            <p style="margin: 0; padding: 0; text-align: center;color:#ffffff; font-family: Georgia, serif;">Having trouble reading this? <webversion style="color: #d0c297; text-decoration: none; border-bottom: 1px dotted #d0c297">View it in your browser</webversion>. Not interested? <unsubscribe style="color: #d0c297; text-decoration: none; border-bottom: 1px dotted #d0c297">Unsubscribe</unsubscribe> instantly.</p>
                                  </td>
                    </tr>  
                        <tr>
                                    <td align="center" style="font-family: Georgia, serif; padding: 0;" valign="top">
                              <table cellpadding="0" cellspacing="0" border="0" align="center" width="610" height="115" style="font-family: Georgia, serif;background: #403000 url('Images\bg_header.jpg') no-repeat center top; " class="header">
                                        <tr>
                                          <td style="margin: 0; padding: 50px 0 20px;" align="left" valign="bottom"> </td>
                                        </tr>
                                            </table><!-- header-->
                                            <table cellpadding="0" cellspacing="0" border="0" align="center" width="610" style="font-family: Georgia, serif; background: url('Images/bg_header_b2.jpg') no-repeat center top">
                                                      <tr>
                                                      <td width="5" style="font-size: 1px; line-height: 1px;">;</td>
                                          <td width="600" valign="top" align="center" style="font-family: Georgia, serif; padding-bottom: 55px; alignment-adjust: central;" bgcolor="#f3f1ea" class="content">
                                                                <table cellpadding="0" cellspacing="0" border="0" style="color: #717171; font: normal 11px Georgia, serif; margin: 0; padding: 0; alignment-adjust: central;" width="600">
                                                                <tr>
                                                                          <td valign="top" style="padding: 0; margin: 0; padding-top: 10px; alignment-adjust: central;" colspan="3">
                                                                                              <table cellpadding="0" cellspacing="0" border="0" style="color: #717171; font: normal 11px Georgia, serif; margin: 0; padding: 0; alignment-adjust: central;" width="600"> 
                                                                                              <tr>
                                                                                                        <td width="295" align="left" valign="top" style="font-size: 1px; line-height: 1px; padding-left: 10px;"><h2 style="color:#66572a !important; font-weight: bold; margin: 0; padding: 0; line-height: 30px; font-size: 17px; font-family: Georgia, serif;">
                                                                                                    <singleline label="Title">Enter Title Here</singleline>
                                                                                                    </h2>
                                              <p>
                                                <multiline label="Description">Description goes here</multiline>
                                          </p></td>
                                                                                                        <td width="295" height="200" align="left" valign="top" style="font-size: 1px; line-height: 1px; padding-left: 10px;">
                                          </tr>
                                                                                    </table>
                                                                  </td>
                                                                </tr>
                                                                </table> 
                                                      </td>
      
                                                      <td width="5" style="font-size: 1px; line-height: 1px;"></td>
      
                                        </tr>
                                             <tr>
                                              </tr>
                                    </table><!-- body -->
                                            <table cellpadding="0" cellspacing="0" border="0" align="center" width="610" style="font-family: Georgia, serif; line-height: 10px;" bgcolor="#464646" class="footer">
    
    
                                                        <tr>
                                                    <td bgcolor="#261e06" align="center" style="padding: 15px 0 15px; line-height: 1.2; font-size: 11px; color:#c0c0c0; margin: 0; font-family: Georgia, serif; " valign="top">
                                                                          <multiline label="Description"><p>Harvestime Books — Box 300, Altamont, TN 37301. Ph +1 931-692-2777</p></multiline>
                                                    </td>
                                        </tr>
                                    </table><!-- footer-->
                                    </td>
                        </tr>
        </table>
      </body>
    </html>
    
    

    sperry1975 wrote:

    When I have this open in dreamweaver, I see everything displayed as it should be, but when I saw in a browser or use the Adobe Browserlab it fails to load the images.  After I changed url (images...) images of the url then it has not display images in dreamweaver either, which certainly did not.

    I think you have misunderstood what I meant by the apostrophes - you deleted the brackets/parentheses.

    Change:

    url('Images\bg_header.jpg')

    TO:

    url(Images\bg_header.jpg)

    --------------------------------------------------------

    EDIT: / / assuming that your links are ok, the reason why the main image doesn't show was due to the background color of cell with the priority on graphical background you have assigned - something I mentioned below. The top graphic seemed good to me.

    Line 47:bgcolor = "#f3f1ea" class = "content" >

Maybe you are looking for