Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access_Union Query of Oracle Database

Status
Not open for further replies.
Mar 2, 2005
171
US
I am interested in obtaining and combining all records from 3 tables within an Oracle Database ("Account_Payor", "Account_Payment_Detail" and "Customer_Encounter" tables) that were updated today as reflected in the "Date Updated" field on these tables.

The Date_Updated field on these tables have a date and time component. Using "Format(Date_Updated),"m/d/yy")" enables the display of the date that the record was updated within Oracle. However, I am not able to selectively display records that have been updated today or for any particular date (say July 15, 2005). Therefore, I receive all records within the Oracle database. For example, if I enter "Date()" along the criteria row, I do not receive the Oracle records that have been updated today.

How should the Access SQL script displayed below be modified to display all the accounts from the 3 Oracle tables that were updated today?

(My initial thought is that I would use a Union query within the SQL view of Access because the QBE environment doesn't appear to support Union queries.)

SELECT DISTINCT ACCOUNT_PAYOR.ACCOUNT_ID AS EP_CID,
ACCOUNT_PAYMENT_DETAIL.ACCOUNT_NO AS EPD_Enc, CUSTOMER_ENCOUNTER.TOTAL_CHARGES AS
PE_TotChgs, CUSTOMER_ENCOUNTER.EXPECTED_REIMBURSEMENT AS PE_ExpReimb, CUSTOMER_ENCOUNTER.DATE_BILLED AS PE_DateBilled, ACCOUNT_PAYOR.TOTAL_PAYMENTS AS
EP_TotPymts, CUSTOMER_ENCOUNTER.NONCOVERED_DT_CHARGES AS PE_NonCovDTChgs, CUSTOMER_ENCOUNTER.NONCOVERED_FP_CHARGES AS PE_NonCovFPChgs, Sum(ENCOUNTER_TRANSACTION_DETAILS.ADJUSTMENT_AMOUNT) AS ETD_AdjAmt, ENCOUNTER_TRANSACTION_DETAILS.TRANSACTION_CODE AS ETD_TransCd, ACCOUNT_PAYOR.RANK
FROM ((ACCOUNT_PAYMENT_DETAIL INNER JOIN ACCOUNT_PAYOR ON
ACCOUNT_PAYMENT_DETAIL.ACCOUNT_NO = ACCOUNT_PAYOR.ACCOUNT_NO) INNER JOIN
ENCOUNTER_TRANSACTION_DETAILS ON ACCOUNT_PAYMENT_DETAIL.ACCOUNT_NO =
ENCOUNTER_TRANSACTION_DETAILS.ACCOUNT_NO) INNER JOIN CUSTOMER_ENCOUNTER ON
(ACCOUNT_PAYOR.ACCOUNT_NO = CUSTOMER_ENCOUNTER.ACCOUNT_NO) AND (ENCOUNTER_TRANSACTION_DETAILS.ACCOUNT_NO = CUSTOMER_ENCOUNTER.ACCOUNT_NO) AND
(ACCOUNT_PAYMENT_DETAIL.ACCOUNT_NO = CUSTOMER_ENCOUNTER.ACCOUNT_NO)
GROUP BY ACCOUNT_PAYOR.ACCOUNT_ID, ACCOUNT_PAYMENT_DETAIL.ACCOUNT_NO,
CUSTOMER_ENCOUNTER.TOTAL_CHARGES, CUSTOMER_ENCOUNTER.EXPECTED_REIMBURSEMENT,
CUSTOMER_ENCOUNTER.DATE_BILLED, ACCOUNT_PAYOR.TOTAL_PAYMENTS,
CUSTOMER_ENCOUNTER.NONCOVERED_DT_CHARGES, CUSTOMER_ENCOUNTER.NONCOVERED_FP_CHARGES,
ENCOUNTER_TRANSACTION_DETAILS.TRANSACTION_CODE, ACCOUNT_PAYOR.RANK
HAVING (((ACCOUNT_PAYOR.ACCOUNT_ID) Not In ("ABC3","ABC4","ABC5")) AND
((ENCOUNTER_TRANSACTION_DETAILS.TRANSACTION_CODE) In ('5086','5087','5088')) AND
((ACCOUNT_PAYOR.RANK)=1))
ORDER BY ACCOUNT_PAYOR.ACCOUNT_ID, ACCOUNT_PAYMENT_DETAIL.ACCOUNT_NO


Thanks in advance for any additional insight.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top