473,419 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

I want to join two queries to create a new query which will have all the information

Below is the details of two queries and sql behind it and i'm doing this in Peoplesoft.Using Psquery.
Any help or procedure greatly appreciated.

IIGL_DEPT_AP_BVA_DETAIL:

SQL:
Expand|Select|Wrap|Line Numbers
  1. SELECT A.BUSINESS_UNIT, A.ACCOUNT, E.DESCR, A.LINE_DESCR, D.NAME1, F.INVOICE_ID, TO_CHAR(F.INVOICE_DT,'YYYY-MM-DD'), C.MONETARY_AMOUNT, A.DEPTID, B.DESCR, A.JRNL_LINE_SOURCE, A.CURRENCY_CD, TO_CHAR(A.JOURNAL_DATE,'YYYY-MM-DD'), A.JOURNAL_ID,E.SETID,E.ACCOUNT,TO_CHAR(E.EFFDT,'YYYY-MM-DD') 
  2.   FROM PS_JRNL_LN A, PS_SP_BU_GL_OPRVW A1, PS_JRNL_HEADER B, PS_VCHR_ACCTG_LINE C, PS_SP_BU_AP_OPRVW C1, PS_PYMNT_XREF_VW F, PS_PAYMENT_TBL D, PS_GL_ACCOUNT_TBL E 
  3.   WHERE A.BUSINESS_UNIT = A1.BUSINESS_UNIT 
  4.     AND A1.OPRID = 'CHAYNES' 
  5.     AND B.BUSINESS_UNIT = A1.BUSINESS_UNIT 
  6.     AND C.BUSINESS_UNIT = C1.BUSINESS_UNIT 
  7.     AND C1.OPRID = 'CHAYNES' 
  8.     AND ( A.LEDGER = 'ACTUALS' 
  9.      AND A.DEPTID = :1 
  10.      AND A.JOURNAL_DATE BETWEEN TO_DATE(:2,'YYYY-MM-DD') AND TO_DATE(:3,'YYYY-MM-DD') 
  11.      AND A.BUSINESS_UNIT = B.BUSINESS_UNIT 
  12.      AND A.JOURNAL_ID = B.JOURNAL_ID 
  13.      AND A.JOURNAL_DATE = B.JOURNAL_DATE 
  14.      AND ( A.JRNL_LINE_SOURCE = 'GAP' 
  15.      AND A.BUSINESS_UNIT =  C.BUSINESS_UNIT_GL(+) 
  16.      AND A.JOURNAL_ID =  C.JOURNAL_ID(+) 
  17.      AND A.JOURNAL_DATE =  C.JOURNAL_DATE(+) 
  18.      AND A.JOURNAL_LINE =  C.JOURNAL_LINE(+) 
  19.      AND A.LEDGER =  C.LEDGER(+) 
  20.      AND B.JRNL_HDR_STATUS = 'P' 
  21.      AND C.BUSINESS_UNIT = F.BUSINESS_UNIT 
  22.      AND C.VOUCHER_ID = F.VOUCHER_ID 
  23.      AND D.REMIT_VENDOR = F.VENDOR_ID) 
  24.      AND F.REMIT_SETID = D.REMIT_SETID 
  25.      AND F.REMIT_VENDOR = D.REMIT_VENDOR 
  26.      AND F.BANK_SETID = D.BANK_SETID 
  27.      AND F.BANK_CD = D.BANK_CD 
  28.      AND F.BANK_ACCT_KEY = D.BANK_ACCT_KEY 
  29.      AND F.PYMNT_ID_REF = D.PYMNT_ID_REF 
  30.      AND F.PYMNT_ID = D.PYMNT_ID 
  31.      AND D.PYMNT_STATUS IN ('N','P') 
  32.      AND A.BUSINESS_UNIT = '21000' 
  33.      AND E.ACCOUNT = A.ACCOUNT 
  34.      AND E.EFFDT = 
  35.         (SELECT MAX(E_ED.EFFDT) FROM PS_GL_ACCOUNT_TBL E_ED 
  36.         WHERE E.SETID = E_ED.SETID 
  37.           AND E.ACCOUNT = E_ED.ACCOUNT 
  38.           AND E_ED.EFFDT <= SYSDATE) 
  39.      AND A.CURRENCY_CD = 'USD' ) 
  40.   ORDER BY 11, 14, 2

RECORDS:

Expand|Select|Wrap|Line Numbers
  1.     AJRNL_LN - Journal Line Data
  2.  
  3.     BJRNL_HEADER - Journal Header Data
  4.  
  5.     C VCHR_ACCTG_LINE - AP Accounting Entries
  6.  
  7.     F PYMNT_XREF_VW - AP Payment Voucher Information
  8.  
  9.         D PAYMENT_TBL - AP Disbursements
  10.  
  11.         E GL_ACCOUNT_TBL - Accounts

IIGL_DEPT_BVA_DETAILS:

SQL:
Expand|Select|Wrap|Line Numbers
  1. SELECT A.BUSINESS_UNIT, A.JOURNAL_ID, TO_CHAR(A.JOURNAL_DATE,'YYYY-MM-DD'), A.ACCOUNT, A.CURRENCY_CD, A.MONETARY_AMOUNT, A.LINE_DESCR, A.JRNL_LINE_SOURCE, A.DEPTID, B.DESCR 
  2.   FROM PS_JRNL_LN A, PS_SP_BU_GL_OPRVW A1, PS_JRNL_HEADER B 
  3.   WHERE A.BUSINESS_UNIT = A1.BUSINESS_UNIT 
  4.     AND A1.OPRID = 'CHAYNES' 
  5.     AND B.BUSINESS_UNIT = A1.BUSINESS_UNIT 
  6.     AND ( A.LEDGER = 'ACTUALS' 
  7.      AND A.DEPTID = :1 
  8.      AND A.JOURNAL_DATE BETWEEN TO_DATE(:2,'YYYY-MM-DD') AND TO_DATE(:3,'YYYY-MM-DD') 
  9.      AND A.BUSINESS_UNIT = B.BUSINESS_UNIT 
  10.      AND A.JOURNAL_ID = B.JOURNAL_ID 
  11.      AND A.JOURNAL_DATE = B.JOURNAL_DATE 
  12.      AND A.JRNL_LINE_SOURCE NOT IN ('TWL') 
  13.      AND B.JRNL_HDR_STATUS = 'P' 
  14.      AND A.BUSINESS_UNIT = '21000' 
  15.      AND A.ACCOUNT > '499999' 
  16.      AND B.SOURCE <> 'CLO' ) 
  17.   ORDER BY 4, 8, 3
RECORDS:
Expand|Select|Wrap|Line Numbers
  1.         A JRNL_LN - Journal Line Data
  2.  
  3.         B JRNL_HEADER - Journal Header Data
Thanks
Sep 7 '10 #1
5 2921
ck9663
2,878 Expert 2GB
Aside from AND A.DEPTID = :1 , everything seems to be just an INNER join. I don't know what those date functions are, though. And that (+) after the column. Other than that, most of those syntax will work in MS SQL, unless I miss something.

Happy Coding!!!

~~ CK
Sep 7 '10 #2
Thanks CK.... for your response
I tried inner and outer joint but didn't get it may be missing some expression,don't know
Sep 7 '10 #3
ck9663
2,878 Expert 2GB
Can you post what your MS SQL query looks like?

~~ CK
Sep 7 '10 #4
Hi Ck,
I have sql query only since i,m a functional consultant idon't have access to database.
Above mentioned are Sql queries.

Thanks for your response and contribution.
Sep 7 '10 #5
ck9663
2,878 Expert 2GB
What does those colon means?


~~ CK
Sep 7 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Tropos | last post by:
Query: Will a MutexGuard object release before a function return value is copied? Consider the C++ code: class MutexGuard //A familiar sort of class for making mutexes exception-safe { . ....
2
by: terence.parker | last post by:
I am often faced with the dilemma of whether to use a JOIN query across three tables in order to grab a bunch of results - or whether to create another table to represent what I want. The latter is...
2
by: Simon Pleasants | last post by:
Am something of a newbie at this, so please bear with any stupid questions. I have created a database to track shipments that we import. The information is stored in a table and I have created...
9
by: deko | last post by:
I need to create a Recordset of all records that appear in one table but do NOT appear in another. To get the records that appear in BOTH tables, I can do this: SELECT tblEntity.Entity_ID...
2
by: mael.iosa | last post by:
Hi, I'm new to this group and fairly new to Access. I have a bunch of data, and after several other queries, I generate the following query which has two fields: Bin, Time 20 3.5 20 3.9 20...
0
by: iworldsatellite | last post by:
hi i m developing an accounting system, i m creating separate database for each company's account so want to implement user-level security wizard from vb code, so i need to create new workgroup...
7
by: Jim | last post by:
How do I program visual basic to create a "Find Unmatched Query"? I have two tables: - TodaysImport - YesterdaysImport Both tables have the same 6 fields: - User
9
WyvsEyeView
by: WyvsEyeView | last post by:
I have a form that has four unbound combo boxes: cboType, cboVersion, cboStatus, cboReview. I want to write a query that basically lets users make selections in as many combo boxes as apply...only...
2
by: muhammad | last post by:
i want join to this group
0
by: Joel Heenan | last post by:
Python List, We have a setup where we have implemented NIS Netgroups through LDAP. I'm looking to query this information through python. We don't have a nis domain or nis server so I don't think...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.