Count on a table with header and row data in the query

Hello

I have an obligation to prepare a report that shows the metrics on the provider. I need to find the total PO for this provider, which fit the Bill

report must be mealgne of #ofpo, #invoice, total_inv_amt and total_po_amt, total_tax_amt with numbers also with the point in time. So my question is how do we achieve this I have this below query that gives all the data but do not know how to get the counties with that. All ideas

SELECT hou.name,
POV. $VENDOR_NAME,
API.invoice_num,
API.invoice_id,
invoice_date,
gl_date,
API.invoice_currency_code,
APID.line_type_lookup_code inv_line_type,
APID. Description inv_description,
APID.amount,
APID.unit_price inv_price,
amount_paid,
apt. Name payment_terms,
payment_status_flag,
APC.check_number,
APC.check_date,
Poh.Segment1 po_num,
Poh.CREATION_DATE po_creation_date,
por. CREATION_DATE po_rel_creation_date,
por.release_num,
pol.line_num,
MC. Segment1 category_name,
(select item_num msi.segment1
MSI inv.mtl_system_items_b
where msi.inventory_item_id = pol.item_id
and msi.organization_id = 1) item_num.
pol.item_description po_item_description,
Poll.need_by_date,
pol.unit_price po_price,
Poll.Quantity,
Poll.quantity_cancelled,
Poll.quantity_received,
Poll.quantity_billed
OF api ap.ap_invoices_all,.
Hou hr_operating_units,.
apt, ap_terms_tl
AP.ap_invoice_distributions_all apid,
pod po.po_distributions_all,
Po.po_vendors pov,
Po.po_headers_all poh,
Po.po_lines_all pol,
survey of po.po_line_locations_all,
por po.po_releases_all,
AP.ap_checks_all apc,
AP.ap_invoice_payments_all IPA,
-inv.mtl_system_items_b msi,
Apps.mtl_categories_b mc
WHERE apt.term_id = api.terms_id
AND hou.organization_id = api.org_id
AND BETWEEN TRUNC (poh.creation_date): p_start_date AND: p_end_date
AND api.invoice_id = apid.invoice_id
AND apid.po_distribution_id = pod.po_distribution_id (+)
AND pov.vendor_id = api.vendor_id
AND poh.po_header_id (+) = pod.po_header_id
AND poll.line_location_id (+) = pod.line_location_id
AND pol.po_line_id (+) = pod.po_line_id
AND apip.check_id = apc.check_id (+)
AND apip.invoice_id (+) = api.invoice_id
AND mc.category_id (+) = pol.category_id
AND por.po_release_id (+) = pod.po_release_id
AND pov.vendor_id = 1

Hello

Her looks like a job for the COUNT function. That's all I can say with certainty based on the information you gave.

If you want to see on each line of output, the number of rows with the same value of api.invoice_num has a value for poh.po_header_id, you can use

COUNT (poh.po_header_id) OVER (PARTITION BY api.invoice_num)   AS po_cnt

I could give much better directions if you could post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data. I realize it's hard with so many pictures. To see some of your courses and the desired output, could help.

Tags: Database

Similar Questions

  • I am not able to download apps for my iPhone on the App Store. He just 'waiting '. But never starts the download. I tried with wifi and mobile data. The two are not download apps

    I am not able to download apps for my iPhone on the App Store. He just 'waiting '. But never starts the download. I tried with wifi and mobile data. The two are not downloading the applications Can u find out what's wrong? I use iPhone 5s

    I had the same problem. At the same time hold the screen lock button and the home button until your iPhone restarts. That solved the problem for me.

  • Possible bug: save the table with double and extended precision to the worksheet

    If one concatenates an array of double-precision and an array of precision extended with the 'build' vi table, then recorded using 'Write in a spreadsheet file' vi any digits to the right of the decimal are reset to zero in the saved file. Regardless of the entry of signifier of format (for example %.10f) to the vi 'Write in a spreadsheet file'.

    I'm on Vista Ultimate 32 bit and labview 9.0

    This is a possible bug that is easily circumvented by the conversion of a type before you incorporate arrar in a worksheet. Nevertheless, it's a bug and it cost me some time.

    Hi JL,.

    No, this is not a bug - it's a feature

    Well, if you'd look closer you would recognize the 'save to spreadsheet' as polymorphic VI. As this polymorphic VI does not support the EXTENSION numbers internally (it only supports DBL, I64, and String) LabVIEW selects the instance with more precision: I64 (I64 a 64 bits of precision, DBL that 53...). Your options are:

    -the value of the instance to use as the DBL (by right click and "Select type... »)

    -make a copy of this VI, save it under a different name and make support number of POST (not rework the polymorphic VI like you would break compatibility with other facilities of LV or future revisions)

  • Write the header and mixed data on the worksheet

    Hello world

    I'm having some problems with writing my data in a spreadsheet file... Basically, I chewed my data and got the values that I want... When I stop the loop I want data saved in a spreadheet... The first line must be a header, and the lines below should be the corresponding data, consisting of a string and numeric data. See the example below.

    Topic name, Max Force (N), means Force (N), Min Force (N);
    David, 2134, 23, 284;
    Phil, 1234, 43, 321;
    Tina, 4059, 335, 55;

    Can someone please help with this?

    Kind regards

    Jack

    This will create a queue (test.csv), check if file exists(no:_creates_header_plus_data...if_yes:appends_data_only):save to a folder first... vi test.csv will be saved in this folder also.

  • I can't create a table with SDO_GEOMETRY type of data in the database of 12 c

    Hello

    When I run the following script I get an error please help,

    Error from line: 3 in command.

    create table SPATIAL.warehouses)

    whse_code VARCHAR2 (4) primary key,.

    warehouse of VARCHAR2 (50).

    location SDO_GEOMETRY

    )

    Error report-

    SQL error: ORA-00902: invalid data type

    00902 00000 - "invalid data type".

    * Cause:

    * Action:

    I use a 12 c database.

    Hi guys

    I found the solution by asking my DBA to reinstall localization features using the oracle Installer.

    Now everything works fine.

    Thanks again for the responses.

  • My husband doesn't like the itunes account is under my name.  I have a way that he can have his own name and sign on with her and still exist on the family account?

    My husband doesn't like the itunes account is under my name.  I have a way that he can have his own name and sign on with her and still exist on the family account?  Also, have we HAVE two-step verification?   It's a real pain.

    Yes it can have its own ID and share your content via the family sharing, he needs to sign out of your ID and to create his own, then one of you needs to invite another family sharing.

    You don't need to use 2 verification step, if you want you can disable to my Apple ID

  • Since the last system upgraded my menu bar top with wifi and time, date etc etc is hidden unless I have sulk my cursor on it. Same thing with apps from shingles. How can I restore it is always there?

    Since the last system upgraded my menu bar top with wifi and time, date etc etc is hidden unless I have sulk my cursor on it. Same thing with apps from shingles. How can I restore it is always there? bar menus hidden-how do I restore?

    SystemPreferences-> Dock: automatically hide / show Dock

    SystemPreferences-> general: automatically hide / show menu bar

  • Why is the uncompadible again toolbar google with ff5 and his long, since the introduction of ff5 why havnt u fixed it

    Why is the Google toolbar always uncompilable with ff5 and his long, since the introduction of ff5, why do u not have this fixed

    You are welcome.

    Please click the button solved it next to the answer that meets or solved your problem of Firefox support, it appears when you are connected, so this thread is marked as solved to help other users who may have this same problem.

  • still no luck with highlighting and try to use the Edit with photoshop elements Editor

    still no luck with highlighting and try to use the Edit with photoshop elements Editor.

    2nd try still nothing.JPGYes, I clicked the change of use with photoshop elements, editor in Chief but still, don't put not to...

    still not working.JPGregion and I select view selected in organzier files. I don't understand what is happening. I never had this problem before and I have 12 for a long time.  How can I fix it?


    You can keep answers to the original discussion, or it's going to go very confusing - http://forums.adobe.com/thread/1438997?tstart=0.

    See you soon,.
    --
    Neale
    Insanity is hereditary, get you your children

    If this post or by post from another user solves the original problem, please mark as correct and/or useful messages accordingly. This helps other users with similar trouble getting answers to their questions more quickly. Thank you.

  • Acer asl3600 will not start only get option is F12 and no data on the recovery drive.

    Hi guys have Acer asl3600 will not start only option get is F12 and no data on the recovery as disc was in vista family 32-bit premium version devastated as being disabled and need for my community work & charity, thought best option would be a recovery disk.

    Concerning

    Dennis

    Hello

    Manufacturers recovery disks normally do not have Service Options; they are normally a relocation to the factory only settings option.

    Acer definiterly only reinstall to factory settings, new condition.

    Here is the guide to repair Options using a Vista DVD from Microsoft.

    If a friend or a work acquantance of yours has one, you can borrow and use it for repairs.

    http://www.bleepingcomputer.com/tutorials/repair-Windows-with-Windows-Startup-Repair/

    Table of contents

    1. Overview of Windows Vista repair options
    2. How to perform an automatic repair of Windows Vista using Startup Repair
    3. Advanced Tools Overview
    4. Conclusion

    If you do not or can not borrow a Microsoft DVD there is a download of a file ISO of Vista Startup Repair available that you can put on a Bootable floppy to make the above startup repair and that the method is recommended by a large number of posters in these Forums.

    Unfortunately, you have to buy it.

    Here is a link to it:

    http://NeoSmart.net/blog/2011/Windows-Recovery-discs-updated-reinstated/

    See you soon.

  • Script table with Clob and record another database

    Hello

    How can I read the Clob column data and insert into another table in the database.

    The first Table is quality Test and second Production

    Is there a way without using Export / Import?

    What can I use the charger?



    With the help of 9i

    muttleychess wrote:

    mschnatt wrote:
    You can only try the db-link

    CREATE LINK of the DATABASE to CONNECT to IDENTIFIED BY with the HELP of "";

    and make the table

    create table...
    in select...

    Thank you, but too no work :-(:-(

    SQL> select id,clob_data from myclob@teste;
    select id,clob_data from myclob@teste
    *
    ERRO na linha 1:
    ORA-22992: cannot use LOB locators selected from remote tables
    

    Well you don't have the answer said to

    and make the table

    create table...
    in select...

    Also in the manual, you could save a lot of time if you open.

    http://docs.Oracle.com/CD/B14117_01/AppDev.101/b10796/adlob_wo.htm#1006314

    >
    The following syntax is supported on the remote LOB columns:

    CREATE TABLE t AS SELECT * FROM table1@remote_site;
    INSERT INTO t SELECT * FROM table1@remote_site;
    UPDATE t SET lobcol = (SELECT lobcol FROM table1@remote_site);
    INSERT INTO table1@remote_site select * from local_table;
    UPDATE table1@remote_siteset lobcol = (SELECT lobcol FROM local_table);
    DELETE FROM table1@remote_site 
    

    It is the only syntax support involving some LOBs in remote tables. No other use is supported.

  • Problem with header and QNetworkAccessManager

    I'm having some trouble with authentication.

    According to the documentation imgur , simply use the following for anonymous use:

    Authorization: Client-ID YOUR_CLIENT_ID
    

    That has worked well when I was in QML, I simply used the following with XMLHttpRequest

    xmlhttp.setRequestHeader("Authorization", "Client-ID myclientid...");
    

    Now, I'm trying to download the image within c ++ and am getting error of authentication. I've tried several things, including

    QNetworkAccessManager* netManager = new QNetworkAccessManager();
    QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
    ...
    QHttpPart authPart;
    authPart.setRawHeader("Authorization","Client-ID myclientid..");
    ...
    multiPart->append(authPart);
    ...
    QNetworkReply* ipReply = netManager->post(req, multiPart);
    

    And I'm not sure of what hurts me, but he just keeps return this

    {"data":{"error":"Authentication required","request":"\/3\/upload","method":"POST"},"success":false,"status":401}
    

    Just use setRawHeader as suggested simon_hain.

    That's what I use for my library Imgur QtC ++

    QNetworkRequest request;
    request.setRawHeader("Authorization",  "Client-ID YOU_CLIENT_ID");
    
  • Bad error parameter to insert page number with header and footer.

    Hi I use Adobe Acrobat standard version 7.0.  I am not able to insert page number in the option "header and"footer. "  invited error message like "invalid parameter."  Help, please

    The only available version is DC. You can purchase a permanent license or subscription, which includes future updates. You are at least 7 years too late for a reduced price upgrade.

    I recommend that you use the fi free trial CD on ANOTHER COMPUTER to see if the problem is corrected. Once you uninstall 7 you will be NEVER BE ABLE TO REINSTALL.

  • Create table with several Collections of data control

    Hello

    I have a requirement about to display data in a table. It shows simple, but certain columns in the table are within a collection, and the others are in another collection. I read this chapter Creation of ADF Databound Tables - 11 g Release 1 (11.1.1.7.0), and she explains to create the table with a collection.

    I have no knowledge on the model, I know just as control data, so what should I do? :

    -Ask for the template designer to redraw the control of data to include a collection with all the data?

    -Try to work with the actual data control? If so, how can I create the table several Collections of data control?

    Plese let me know if there is another solution. I work with JDeveloper 11.1.1.7.

    Thank you!

    AAPDL

    Hello

    You can have a managed bean that e... g exposes an ArrayList of objects. This can then binds to the value property of the table. If the object sets the information of table row combination that you get multiple iterators (collections), then the table will display the joined data.

    Frank

  • retrieve the information of partition table with lack of offline data file

    I just restored a backup of a database. When I unzipped data files, I discovered that a single data file was so damaged in the starting order of the database, I had to put the offline data file. The tablespace which reports the data file holds the information of partition of a table. Since I have no archives from when the data file has been created, I know it is not possible to recover the data file, I have to recover as many lines as possible other files in the tablespace data but when export or create the table as what to choose in the affected partition get ORA-00376 : cannot read file 1624 at the moment.

    is there a way to tell oracle to ignore the data offline file and export the remaining data file information?

    Just to clarify my situation a little more;
    iI have a table called PPGA_ACTABOPRE that is partitioned by HASH and has 20 partitions, each partition in a different tablespace and tablespace each have about 8 files of data. A data file in the partition 9 is missing and I want is to get the information from the files of the remaining data, but whenever I issue a select statement or an exp or anything I get ORA-00376.

    I try to set the flag to ignore blocks corrupt with run DBMS_REPAIR. SKIP_CORRUPT_BLOCKS ('PPGA', 'PPGA_ACTABOPRE'); and then select the info but it did not work.

    Any suggestion would be appreciated;
    Thanks in advance

    For the actabopre_p08 partition, some files are available, and we're not. You can access data at the segment level, because some extensions are missing.

    You would need to access the data by rowid. You could loop through dba_extents and use dbms_rowid.create to generate a list of ROWID that may exist in the available data files.

    This may help: -.

    http://kerryosborne.Oracle-guy.com/2009/02/saving-rows-from-corrupt-blocks/
    http://kerryosborne.Oracle-guy.com/scripts/save_u.SQL

    Published by: Robert Geier on March 12, 2010 15:33

Maybe you are looking for

  • When I type 'Shift-3' a sign of the pound sterling, I get

    When I type 'Shift-3' a sign of the pound sterling, I get # "hash". I did something stupid with my keyboard and if so, how to cancel it? I'm (20 inch, early 2008), Mac OS X, 10.11.6, wireless without A1314 keyboard model

  • Cannot use external monitor as primary monitor with Portege M400

    I'm unable to use the extended feature deasktop with my m400. I installed the latest video drivers. When I go to the driver intel graphics media accelerator under display properties and choose extended Office I can't use my external monitor as the pr

  • number format for excel

    Hello My problem is to convert my numbers into a format correct excel. numbers are saved in a spreadsheet and with a Publisher file, it looks like this: 9, 723197E + 0 8, 229011E-1 When I filled out an Excel file with the data, it looks like: 9723,00

  • PCI-MIO-16-1 shows the digital inputs 1-7 on, without same cable connected

    Max, my PCI-MIO-16-1 shows the digital inputs 1-7 as having entries of tension without same cable connected to the Board. No amount of spin with her (to the MAX) seems so he can act correctly in input or output mode. It's true, there are voltages on

  • Problem with Windows 8 downloads

    Hello! I have a problem with the driver downloads. I try to download the drivers for my computer laptop l702x XPS for Win8. There is an option (' windows 8 '), but when I try to download anything, I get an error ("file not found"). It's bad I can't c