Query that link two tables together

I am using this query to extract  Account Payable data:
SELECT T0.DocNum, T0.DocStatus, T0.DocDate, T0.DocDueDate, T0.CardCode, T0.CardName, T0.NumAtCard, T0.DocTotal FROM Akron.dbo.OPCH T0
How would I also add the unique number for each individual payment from these tables?
OVPM and VPM2.
What field links these 2 tables together?

Hi,
You may check this: Incoming Payments Report
Replace all INV with PCH and RCV with VPM
Thanks,
Gordon

Similar Messages

  • Query for Linking Two Tables without Reference

    Hi Folks,
    Good Day!
    I have this dilemma on how to link two tables without a reference. In the Business Partner Master Data, there is a field for the Territory which is from the table OTER. This OTER focuses on its description. Once you have added the particular Territory for that Business Partner, it is being stored in the Territory field of the BP right? Our client wants to have an automated way of searching for the Business Partner's Profit Center in creating a Sales Order wherein it is the same as the Business Partner's Territory. The Profit Center is from the table OPRC.
    When I create a Sales Order, after I have entered the Business Partner/Customer Code, the Profit Center should have the value of the Profit Center Code wherein it is the Business Partner's Territory. My query will go like this:
    Enter the BP/Customer Code automatically the Profit Center code where Profit Name = BP's Territory.
    OTER and OCRD don't have connections. How can it be?
    I'm thinking of retrieving the Territory first before the Profit Center but can you suggest of any other way?
    Thank you much!
    Regards,
    Fringe

    Hi Fringe,
    Okay, I already understood your case here. I presume your configuration as follows:
    OTER (Territory)
    territryID - descript
    1 - Philippine
    2 - Indonesia
    3 - Germany
    OPRC (Cost Centre)
    PrcCode - PrcName
    25 - Philippine
    33 - Indonesia
    47 - Germany
    Was above illustration correct? Then, you could use this formatted search in Cost Centre / Dimension field in Sales Order rows
    SELECT PrcCode FROM OPRC WHERE PrcName=(
    SELECT TOP 1 descript FROM OTER T0
    INNER JOIN OCRD T1 ON T0.territryID=T1.Territory
    WHERE T1.CardCode=$[OCRD.CardCode.0])
    However, I suggest you use a little bit different approach here. Since you can't define Territory Code / Territory ID (you could only type the Territory name, Philippine etc.), why don't you standardize Territory name with Cost Centre code? Let say, you define Philippine as PHI, Indonesia as INA, Germany as DEU and so on. Therefore, user can read the Cost Centre or more precisely Distribution Rules in Sales Order form in more familiar way.
    OTER (Territory)
    territryID - descript
    1 - PHI
    2 - INA
    3 - DEU
    OPRC (Cost Centre)
    PrcCode - PrcName
    PHI - Philippine
    INA - Indonesia
    DEU - Germany
    When FMS worked in Sales Order document, your user will read PHI instead of 25, should be more familiar to them. With that being said, you could use simpler FMS
    SELECT descript FROM OTER T0
    INNER JOIN OCRD T1 ON T0.territryID=T1.Territory
    WHERE T1.CardCode=$[OCRD.CardCode.0]
    You only need to maintain consistency between Territory Name and Cost Centre code. Just my two cents. Hope this help.
    Best Regards,
    Hendry Wijaya

  • How to link 2 table together?

    Hi All - I'm a new APEX user and would like to create 2 tables - one primary table, where you input data in and a secondary table, where any update you do to the primary table goes to.
    In the primary table - it consists of a primary key which is set to be generated. This primary key will be used to identify the entry later on for query purposes. This also have a variable (Number), which will be used later on as a foreign key to the secondary table to link the two tables together. Then couple of data fields to enter other things.
    In the secondary table - I've also created a primary key for this table, set to be generated (this is used as the same purpose)
    When I try to create a foreign key in the secondary table, using the variable (Number) from the primary table, I keep on getting an error and end up not able to finish the creation of the secondary table.
    Any clue or any documentation anyone can point me too is greatly appreciated...Many thanks in advance.
    Thanks,
    Joy

    Hi Joy,
    There is so much wrong herre that I am not sure where to start except to recommend that you go back to basics and learn about relational database design.
    Googling "relational database design", "entity relationship modelling" will turn up many references. Also, a trip to a good technical bookshop will also turn up many good books. Pick something that looks like it is aimed at beginners and which you feel you understand.
    Regards
    Andre

  • In ER DIagram using toad( how can i link two tables)

    Hi,
    Any Toad expert can guide me that how can i link two tables in Toad in ER Diagram to show the relationship between two tables.
    Thanks

    Hi,
    I hope there is foreign key relationship in tables, if so then you can click on "Find table dependencies" icon which will draw lines between them.
    ~Vinod

  • How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?

    1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
    When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed  in the stat plan  ?
    2. Does rowsource statistics gives some kind of  understanding of Extended stats ?

    You can get Row Source Statistics only *after* the SQL has been executed.  An Explain Plan midway cannot give you row source statistics.
    To get row source statistics either set STATISTICS_LEVEL='ALL'  in the session that executes theSQL OR use the Hint "gather_plan_statistics"  in the SQL being executed.
    Then use dbms_xplan.display_cursor
    Hemant K Chitale

  • Linking two accounts together

    Are you able to link two accounts together.  For example, I have had an account for a long time, but now my husband has one as well as my son.  My son is currently signed in with my account but I would like to give him his own as well as share what I have with my husband.
    Thanks,
    Stephanee

    Sorry, but it is not possible to merge iTunes Store accounts. You can, however, use content from multiple iTunes Store acounts on any given system or device. You just have to authorize the device to each account. You will have to use the account though which any item was purchased for redownloading, app updates, etc.
    Regards.

  • Linking two computers together

    Can I link two macs together so I have access to both but the other computer doesn't have access to mine?

    If you own both and have admin accounts on them, yes. On the "other" computer, go to System Preferences, Sharing, and turn on File Sharing.
    When the two computers are on the same network, you should see the other computer appear in your sidebar in Finder. Click it, authenticate with your admin details (from the other computer), and you now have access to its files.
    Matt

  • How to link two tables?

    Hello,
    I'm trying to create invoices with Pages, but my question is how can I link two tables in one Pages document?
    Or having two Header Rows with some 'normal' rows between would also be great. (even better)
    I'm trying to calculate my subtotal etc. below my overview of articles.
    Thanks in advance!
    Andy

    (1) no way to link two tables in Pages.
    (2) you may have several header rows, several footer rows but you can't have standard rows between header (or footer) ones.
    You may achieve what you describe without the asked feature.
    Use correct ranges and you will be able to calculate subtotals.
    Yvan KOENIG (VALLAURIS, France) lundi 28 décembre 2009 19:02:38

  • Linking two table..it is look like unpivot but it is not

    Hi guys, I got a situation like this:
    Table A
    create table #fly (company varchar (50), period varchar(6), adcost (int), ppcost (int))
    insert into #fly values ('PanAm', '201401', 100, 200) ,  ('PanAm', '201402', 200, 200) , ('PanAm', '201403', 700, 1000), ('EGAm', '201401', 1100, 1200), ('EGAm', '201402', 7100, 7200)                                                                                                                 
    Table 2 #Cost (firm varchar (100), client varchar (100), period varchar(6), element (varchar 10), tot int) insert into #firm ('Zuck', ''Panam', '201401', ''adcost', 40), ('Zuck', ''Eagam', '201401', ''adcost', 40), ('Zuck', ''Panam', '201402', ''ppcost', 240)                
    As you can see I got in fly the field adcost that is a value in the table #cost. I need to link the two table and I'm wondering whitch is the best way. Another issue is the adcost (#fly) has in #cost two relatives adcost and fixadcost element. I should consider
    both the elements as adcost.  Advices? Thanks

    create table #fly (company varchar (50), period varchar(6), adcost int, ppcost int)
    insert into #fly values ('PanAm', '201401', 100, 200) , ('PanAm', '201402', 200, 200) , ('PanAm', '201403', 700, 1000), ('EGAm', '201401', 1100, 1200), ('EGAm', '201402', 7100, 7200)
    create table #Cost (firm varchar (100), client varchar (100), period varchar(6), element varchar (20), tot int)
    insert into #cost values ('Zuck', 'Panam', '201401', 'adcost', 40), ('Zuck', 'Eagam', '201401', 'adcost', 40)
    , ('Zuck', 'Panam', '201401', 'fixedadcost', 40)
    , ('Ford', 'Panam', '201401','ppcost', 240)
    select * from #Cost
    select * from #Fly
    Select company,f.period,adcost, (c1.tot+c2.tot) as [adcost + fixedadcost] , ppcost, c3.tot as [ppcost from Cost] from (select company,period,adcost,ppcost from #Fly
    WHERE company='PanAM' AND period='201401') f
    left join #Cost c1 on c1.period = f.period AND c1.client=f.company AND c1.element ='adcost'
    left join #Cost c2 on c2.period = f.period AND c2.client=f.company AND c2.element ='fixedadcost'
    left join #Cost c3 on c2.period = f.period AND c3.client=f.company AND c3.element ='ppcost'
    drop table #Cost, #Fly

  • Linking Two Folders Together

    Hi,
    I have a 13" MacBook Air Mid 2013, 128GB, 4GB RAM, 1.3 GHz, OS X 10.10 Yosemite.
    When I put a folder in iCloud Drive, the folder is in iCloud Drive and on my Desktop. What I want to do is link the two folders together so when I save a file in the folder on my desktop, it puts it in the folder that's in iCloud Drive too. I hope I have explained this good enough.
    Please help.
    Thanks

    If you own both and have admin accounts on them, yes. On the "other" computer, go to System Preferences, Sharing, and turn on File Sharing.
    When the two computers are on the same network, you should see the other computer appear in your sidebar in Finder. Click it, authenticate with your admin details (from the other computer), and you now have access to its files.
    Matt

  • Linking two jtrees together

    Hello all,
    i want to link two elements in two JTrees
    so when i add a child to one of them at run time
    it will appear in the other too???
    thanks in advance.

    well then all you have to do is to make sure that you add the same "MutableTreeNode" object, (the element you want to link) into both models. adding a child to that node will then fire the update events to the view, i.e. the tree.

  • Linking two switches together.

    hi Guys ,
    quick question in relation to joining two switches together,
    can I link a 2950 switch with a 1000 BASE-SX with a 3560G with 4 SPF ports with fibre and what pitfalls should i look out for .
    Thanks in advance
    Kevin

    Hello,
    So you would like to connect GBIC to SFP, you need Multimode Duplex Fiber Optical cable with SC-LC connectors. If SFP to SFP you need the same cably type with LC-LC connectors.
    http://www.cisco.com/en/US/products/hw/routers/ps341/prod_module_installation_guide09186a00801cc731.html
    http://cisco.com/en/US/products/hw/modules/ps5455/products_data_sheet09186a008014cb5e.html
    bye
    FCS
    Please rate me if I helped.

  • Linking two tables with no duplicated records!

    Hi,
    I have two tables now with both tables is having the common filed matnr.
    now using this field MATNR from  first table ,i need to fetch projectno from the other table which has to be unique.if there are more than one entry found for MATNR in question then that must not be updated to the first table!
    any ideas?
    Raj

    hi raj,
    try this code.
    data:
      ld_count type p,
      ld_tabix type sy-tabix.
    loop at itab1.
      move sy-tabix to ld_tabix.
      ld_count = 0.
      loop at itab2 where matnr eq itab1-matnr.
        add 1 to ld_count.
      endloop.
      if ld_count = 1.
        read table itab2 with key matnr = itab1-matnr.
        move itab2-project to itab1-project.
        modify itab1 index ld_tabix.
      endif.
    endloop.

  • To link two tables in ap

    hi
    could someone pls guide me to link ap_invoices_all table with gl_code_combinationsthanking in advance
    Edited by: makdutakdu on Oct 14, 2010 12:15 PM

    Hello.
    Use the following query (R11i):
    SELECT i.invoice_num "Invoice Nr.",
    c.segment1 "Segment1",
    l.ae_line_type_code "Line Type",
    l.accounted_dr "Debit",
    l.accounted_cr "Credit"
    FROM ap_ae_lines_all l, ap_ae_headers_all h, ap_invoices_all i, ap_accounting_events_all e, gl_code_combinations c
    WHERE e.source_table = 'AP_INVOICES'
    AND i.invoice_num = '<your invoice nymber>'
    AND l.ae_header_id = h.ae_header_id
    AND e.accounting_event_id = h.accounting_event_id
    AND e.source_id = i.invoice_id
    AND l.code_combination_id = c.code_combination_id
    AND i.org_id = <your org_id>
    As you may have more than one invoice with the same number, the query may return more lines then expected. To restrict it, enter the vendor_id from table AP_INVOICES_ALL.
    Hope this helps.
    Octavio
    Edited by: Octopus Rex on Oct 14, 2010 4:10 AM

  • The query that charges the table CE_AVAILABLE_TRANSACTIONS_TMP

    hello,
    I need the query that loads(charges) the temporary table: CE_AVAILABLE_TRANSACTIONS_TMP.
    thanks.

    I need the query that loads(charges) the temporary table: CE_AVAILABLE_TRANSACTIONS_TMP.If you have the steps to do the same from the application you could simply enable trace and generate the tkprof file -- FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12 [ID 296559.1]
    Thanks,
    Hussein

Maybe you are looking for