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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Union only returns partial data

Status
Not open for further replies.

rrenda

MIS
Mar 8, 2011
1
US
Good Evening,

I've created a union statement which has 2 subqueries,in Oracle 11 sql developer. It compiles successfully, but when I looked at the data, I noticed that the only information being returned is from the first subquery. I've been troubleshooting it for the past 2 days and am completely out of options. Can someone take a look and point me in the right direction. Thanks

SELECT "ACACTIVITY"."ACTIVITY_GRP",
"ACACTIVITY"."ACTIVITY",
"ACACTIVITY"."BALANCE_AMOUNT",
"ACACTGRP"."DESCRIPTION",
"ACACTIVITY"."DESCRIPTION",
"ACACCTCAT"."DESCRIPTION",
"ACACCTCAT"."ACCT_CATEGORY",
"ACBUDDTL"."BALANCE",
"ACTRANS"."ACCOUNT" AS ACTRANSACCT,
"ACTRANS"."ACCT_UNIT" AS ACTRANSACCTUNIT,
"ACTRANS"."SUB_ACCOUNT" AS ACTRANSSUBACT,
"ACTRANS"."POSTING_DATE" AS ACTRANSPOSTDT,
"ACTRANS"."R_SYSTEM" as ACTRANSYS,
"ACTRANS"."REFERENCE" as ACTRANSREF,
"ACTRANS"."DESCRIPTION" as ACTRANSDESC,
"ACTRANS"."TRAN_AMOUNT" as ACTRANSAMT,
"ACTRANS"."UNITS_AMOUNT" as ACTRANSUNIT,
"ACTRANS"."ACT_CURRENCY" as ACTRANCURR,
null as col19,
null as col20,
null as col21
FROM ((("PROD"."ACACTIVITY" "ACACTIVITY" INNER JOIN "PROD"."ACACTGRP" "ACACTGRP" ON "ACACTIVITY"."ACTIVITY_GRP"="ACACTGRP"."ACTIVITY_GRP")
INNER JOIN "PROD"."ACTRANS" "ACTRANS" ON "ACACTIVITY"."ACTIVITY"="ACTRANS"."ACTIVITY")
INNER JOIN "PROD"."ACBUDDTL" "ACBUDDTL" ON ("ACACTIVITY"."ACTIVITY"="ACBUDDTL"."ACTIVITY") AND ("ACACTIVITY"."ACTIVITY_GRP"="ACBUDDTL"."ACTIVITY_GRP"))
INNER JOIN "PROD"."ACACCTCAT" "ACACCTCAT" ON "ACTRANS"."ACCT_CATEGORY"="ACACCTCAT"."ACCT_CATEGORY"
Union
SELECT "ACACTIVITY"."ACTIVITY_GRP",
"ACACTIVITY"."ACTIVITY",
"ACACTIVITY"."BALANCE_AMOUNT",
"ACACTGRP"."DESCRIPTION",
"ACACTIVITY"."DESCRIPTION",
"ACACCTCAT"."DESCRIPTION",
"ACACCTCAT"."ACCT_CATEGORY",
"ACBUDDTL"."BALANCE",
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
"ACCOMMITX"."ACTIVITY",
"ACCOMMITX"."ACCT_CATEGORY",
"ACCOMMITX"."TRAN_AMOUNT"
FROM ((("PROD"."ACACTIVITY" "ACACTIVITY" LEFT OUTER JOIN "PROD"."ACCOMMITX" "ACCOMMITX" ON "ACACTIVITY"."ACTIVITY"="ACCOMMITX"."ACTIVITY")
INNER JOIN "PROD"."ACACTGRP" "ACACTGRP" ON "ACACTIVITY"."ACTIVITY_GRP"="ACACTGRP"."ACTIVITY_GRP")
INNER JOIN "PROD"."ACBUDDTL" "ACBUDDTL" ON ("ACACTIVITY"."ACTIVITY"="ACBUDDTL"."ACTIVITY") AND ("ACACTIVITY"."ACTIVITY_GRP"="ACBUDDTL"."ACTIVITY_GRP"))
INNER JOIN "PROD"."ACACCTCAT" "ACACCTCAT" ON "ACCOMMITX"."ACCT_CATEGORY"="ACACCTCAT"."ACCT_CATEGORY
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top