Unable to make a Right-Outer Join
Unable to implement the following Query in the WebI Report.
In Universe, I have all the 4 views and made the complex right outer join with the constraints from the query. However, i cannot have all the columns in the select clause in WebI Report as i can see queries are breaked up into 4 queries under synchronization folder. And unable to implement the custom query.
Note : There are no primary keys / column to identify unique row. However, combination of columns helps to identify the unique row which is used in join conditions.
How get a report based on the following query
SELECT aht."RESOURCE NAME",
aht.week,
aht.resource_key,
aht."WEEK END DATE",
Round(aht.aht,2),
Round(aht.att,2),
tnr."TNR%",
nr.nr_reason_time,
vw."Complaince",
vw."Rapport_Score",
vw."Solution_Score",
vw."Value_Score",
aht.group_combination_key
FROM (select * from GIM_AHT_ATT where WEEK in ( SELECT DISTINCT LABEL_YYYY_WE FROM DATE_TIME WHERE CAL_DATE BETWEEN (next_day(To_Date(@Prompt('Date:','D',,Mono,Free,Persistent,{'1/1/2011 12:00:00 AM'},User:2),'DD-MM-YYYY HH24:MI:SS'),'Saturday')-34) AND (next_day(To_Date(@Prompt('Date:','D',,Mono,Free,Persistent,{'1/1/2011 12:00:00 AM'},User:2),'DD-MM-YYYY HH24:MI:SS'),'Saturday')-7) ) and RESOURCE_KEY in (Select resource_key from resource_ where resource_type_code ='AGENT' and resource_name in @Prompt('Agent:','A','Activity\User Name',MULTI,CONSTRAINED,Persistent,{'ALL'},user:10))) aht
LEFT OUTER JOIN (Select * from Verint_wfm where Verint_wfm."Week_NUM" in ( SELECT DISTINCT LABEL_YYYY_WE FROM DATE_TIME WHERE CAL_DATE BETWEEN (next_day(To_Date(@Prompt('Date:','D',,Mono,Free,Persistent,{'1/1/2011 12:00:00 AM'},User:2),'DD-MM-YYYY HH24:MI:SS'),'Saturday')-34) AND (next_day(To_Date(@Prompt('Date:','D',,Mono,Free,Persistent,{'1/1/2011 12:00:00 AM'},User:2),'DD-MM-YYYY HH24:MI:SS'),'Saturday')-7) ) and
Verint_wfm."Resource_Key" in (Select resource_key from resource_ where resource_type_code ='AGENT' and resource_name in @Prompt('Agent:','A','Activity\User Name',MULTI,CONSTRAINED,Persistent,{'ALL'},user:10))) vw
ON (aht.week = vw."Week_NUM"
AND aht.resource_key = vw."Resource_Key" )
LEFT OUTER JOIN (Select * from GIM_TNR where GIM_TNR.WEEK in ( SELECT DISTINCT LABEL_YYYY_WE FROM DATE_TIME WHERE CAL_DATE BETWEEN (next_day(To_Date(@Prompt('Date:','D',,Mono,Free,Persistent,{'1/1/2011 12:00:00 AM'},User:2),'DD-MM-YYYY HH24:MI:SS'),'Saturday')-34) AND (next_day(To_Date(@Prompt('Date:','D',,Mono,Free,Persistent,{'1/1/2011 12:00:00 AM'},User:2),'DD-MM-YYYY HH24:MI:SS'),'Saturday')-7) ) and GIM_TNR.RESOURCE_KEY in (Select resource_key from resource_ where resource_type_code ='AGENT' and resource_name in @Prompt('Agent:','A','Activity\User Name',MULTI,CONSTRAINED,Persistent,{'ALL'},user:10))) tnr
ON (aht.week = tnr.week
AND aht.resource_key = tnr.resource_key
AND aht.group_combination_key = tnr."Group Combination Key" )
LEFT OUTER JOIN (Select * from GIM_NR_REASON where GIM_NR_REASON.LABEL_YYYY_WE in ( SELECT DISTINCT LABEL_YYYY_WE FROM DATE_TIME WHERE CAL_DATE BETWEEN (next_day(To_Date(@Prompt('Date:','D',,Mono,Free,Persistent,{'1/1/2011 12:00:00 AM'},User:2),'DD-MM-YYYY HH24:MI:SS'),'Saturday')-34) AND (next_day(To_Date(@Prompt('Date:','D',,Mono,Free,Persistent,{'1/1/2011 12:00:00 AM'},User:2),'DD-MM-YYYY HH24:MI:SS'),'Saturday')-7) ) and GIM_NR_REASON.RESOURCE_KEY in (Select resource_key from resource_ where resource_type_code ='AGENT' and resource_name in @Prompt('Agent:','A','Activity\User Name',MULTI,CONSTRAINED,Persistent,{'ALL'},user:10))) nr
ON(aht.week = nr.label_yyyy_we
AND aht.resource_key = nr.resource_key
AND aht.group_combination_key = nr."Group Combination Key" );
In Unvierse Designer under File>Paramters>SQL Tab, all "Mutiple Path" options are unchecked?
Regards,
Bilahari M
Similar Messages
-
Choice of left or right outer join
Hi Experts,
I have a two tables like named as emp demo
desc emp
empname varchar2(50)
empid number
desc demo
empname varchar2(50)
empid number
when i implement the below quries i'm getting the same o/p.
queries like
select e.ename from emp e left outer join demo d on (e.empid=d.empid);
select e.ename from demo d right outer join emp e on (d.empid=e.empid);
In this case which query is most prefer
Thnks in advance
HHi,
943338 wrote:
Hi Experts,
I have a two tables like named as emp demo
desc emp
empname varchar2(50)
empid number
desc demo
empname varchar2(50)
empid number
when i implement the below quries i'm getting the same o/p.Right. You're getting the same error, because there is no ename column. If you change ename to empname, then you'll still get the same results, because
x LEFT OUTER JOIN y ON zis equivalent to
y RIGHT OUTER JOIN x ON zin results and performance.
queries like
select e.ename from emp e left outer join demo d on (e.empid=d.empid);
select e.ename from demo d right outer join emp e on (d.empid=e.empid);
In this case which query is most preferBoth are equally efficient.
Since most people never use RIGHT OUTER JOIN, it might make maintenance eaiser if you don't use it, either. I would use LEFT OUTER JOIN. -
Could any one tell me how to do the left outer join or right outer join?
Could any one tell me how to do the left outer join or right outer join in Webi Rich Client? thanks.
we can do it in two ways
1. In web intelligence level on the query panel click the sql query and write the statement what ever u want there by modifying the existing statement.
2. In universe level select the fields in the two tables that you want to make join and create the join between two tables directly by joining field in table 1 to the field in the table 2 by drawing a line and double click on the line to view the join properties,then on join properties if we check the table 1 outer then it is left outer join if we check on table 2 outer then it will be the right outer join.after exporting the universe to the central sever we are now ready to use in web intelligence with out being changed anything in the sql query.
endorse me if it is useful.
thanks & regards
Sreekanth. -
Here is a query and desired output for a weekly sales report. The problem is that if no data exists for given businessdate, the report is empty. It should show store with zeroed totals.
NOTES:
1. storenbr must be string
2. bow, eow = beginning and end of week
3. I have no say-so on the date format
with report_stores as
( select 501 as storeid from dual union all
select 22 as storeid from dual union all
select 24 as storeid from dual
, store_details as
select 501 as storeid, '6504' as storenbr, 'Quincey Circle' as storename from dual union all
select 22 as storeid, '2385' as storenbr, 'Goodlet' as storename from dual union all
select 24 as storeid, '4290' as storenbr, 'Poplar' as storename from dual
, sales_data as
select 501 as storeid, to_date('12/01/2010', 'MM/DD/YYYY') as businessdate, 100 as sales_amt, 50 as guestcount from dual union all
select 22 as storeid, to_date('12/01/2010', 'MM/DD/YYYY') as businessdate, 200 as sales_amt, 50 as guestcount from dual union all
select 24 as storeid, to_date('12/01/2010', 'MM/DD/YYYY') as businessdate, 300 as sales_amt, 50 as guestcount from dual union all
select 501 as storeid, to_date('12/02/2010', 'MM/DD/YYYY') as businessdate, 400 as sales_amt, 100 as guestcount from dual union all
select 22 as storeid, to_date('12/02/2010', 'MM/DD/YYYY') as businessdate, 500 as sales_amt, 100 as guestcount from dual union all
select 24 as storeid, to_date('12/02/2010', 'MM/DD/YYYY') as businessdate, 600 as sales_amt, 100 as guestcount from dual
select storenbr
, to_date('01/30/2011', 'MM/DD/YYYY') as EOW
, sum(nvl(sales_amt, 0)) as sales_amount
, sum(nvl(sales.guestcount , 0)) as guestcount
from report_stores stores
inner join store_details details on details.storeid = stores.storeid
left outer join sales_data sales on sales.storeid = stores.storeid
and sales.businessdate between to_date('01/24/2011', 'MM/DD/YYYY') and to_date('01/30/2011', 'MM/DD/YYYY')
group by storename, to_date('01/30/2011', 'MM/DD/YYYY');However, when I make date dynamic by adding a dates table, I don't get output.
with report_dates as
select to_date('01/05/2011', 'MM/DD/YYYY') as businessdate, 'Wednesday' as day_name, 2 as week_nbr, to_date('01/03/2011', 'MM/DD/YYYY') as bow, to_date('01/09/2011', 'MM/DD/YYYY') as eow from dual union all
select to_date('01/24/2011', 'MM/DD/YYYY') as businessdate, 'Monday' as day_name, 5 as week_nbr, to_date('01/24/2011', 'MM/DD/YYYY') as bow, to_date('01/30/2011', 'MM/DD/YYYY') as eow from dual
, report_stores as
( select 501 as storeid from dual union all
select 22 as storeid from dual union all
select 24 as storeid from dual
, store_details as
select 501 as storeid, '6504' as storenbr, 'Quincey Circle' as storename from dual union all
select 22 as storeid, '2385' as storenbr, 'Goodlet' as storename from dual union all
select 24 as storeid, '4290' as storenbr, 'Poplar' as storename from dual
, sales_data as
select 501 as storeid, to_date('12/01/2010', 'MM/DD/YYYY') as businessdate, 100 as sales_amt, 50 as guestcount from dual union all
select 22 as storeid, to_date('12/01/2010', 'MM/DD/YYYY') as businessdate, 200 as sales_amt, 50 as guestcount from dual union all
select 24 as storeid, to_date('12/01/2010', 'MM/DD/YYYY') as businessdate, 300 as sales_amt, 50 as guestcount from dual union all
select 501 as storeid, to_date('12/02/2010', 'MM/DD/YYYY') as businessdate, 400 as sales_amt, 100 as guestcount from dual union all
select 22 as storeid, to_date('12/02/2010', 'MM/DD/YYYY') as businessdate, 500 as sales_amt, 100 as guestcount from dual union all
select 24 as storeid, to_date('12/02/2010', 'MM/DD/YYYY') as businessdate, 600 as sales_amt, 100 as guestcount from dual
select storenbr
, eow
, sum(nvl(sales_amt, 0)) as sales_amount
, sum(nvl(sales.guestcount , 0)) as guestcount
from report_stores stores
inner join store_details details on details.storeid = stores.storeid
right outer join sales_data sales on sales.storeid = stores.storeid
inner join report_dates dte on dte.businessdate = to_date('01/24/2010', 'MM/DD/YYYY')
-- and sales.businessdate between bow and eow
group by storenbr, eow
;What am I doing wrong? For kicks I also tried switching the JOINS like :
Select *
from sales_data sales
left outer join report_stores stores on stores.stoeid = sales.storeid but couldn't make this work either.Hi,
Thanks for posting the sample data in a useful form.
Don't forget to post the results you want to get from that data. Is this what you want?
STOR EOW SALES_AMOUNT GUESTCOUNT
6504 0 0
2385 0 0
4290 0 0If so, you want to inner-join sales_data and report_dates, and then outer-join that result set to report_stores.
Here's one way to do that:
SELECT details.storenbr
, dte.eow
, NVL (SUM (sales.sales_amt), 0) AS sales_amount
, NVL (SUM (sales.guestcount), 0) AS guestcount
FROM report_stores stores
INNER JOIN store_details details ON details.storeid = stores.storeid
LEFT OUTER JOIN ( sales_data sales
JOIN report_dates dte ON sales.businessdate BETWEEN dte.bow
AND dte.eow
) ON sales.storeid = stores.storeid
GROUP BY details.storenbr
, dte.eow
;As in your first query, you want the every row in report_stores to appear in the output, whether it matches anything in sales+dte or not, so you want to continue saying "FROM report_stores ... *LEFT* OUTER JOIN ...".
You'll notice that I changed
SUM (NVL (x, 0)) to
NVL (SUM (x), 0). Both give the same results, but, if you have 1000 rows, the former calls NVL 1000 times, but the latter only calls NVL once, so it's more efficient. -
How to use left outer joins ,right outer joins and order by clause for belo
Hi,
How to use left outer joins ,right outer joins and order by clause for below XML query.
The query which is red colour returns null then its not displaying any values for columns in that tables. Tried decode, nvl function hasn't worked.
SELECT XMLAGG ( XMLELEMENT( "P", XMLFOREST( P.process_id AS Ppid,
(SELECT XMLAGG( XMLELEMENT( "PI", XMLFOREST( PI.question_id AS PIqid,
PI.process_id AS PIpid,
PI.innertext AS
PItext, PI.itemtype AS PItype,
PI.linkfrom AS PIfrom,
PI.linkto AS PIto,
PI.associated AS PIas,
PI.content_id AS PIc,
PI.exitpoint1_id AS PIe1,
PI.exitpoint2_id AS PIe2,
PI.exitpoint3_id AS PIe3,
PI.followoncall AS PIfoc,
PI.userinput AS PIui,
PI.resolveidentifier AS PIri,
PI.libquestion_idfk AS PIlqid,
PI.isLocked AS PIstls,
PI.PreviousAnswer AS PIPAns,
PI.VisibleToAgent AS PIVAgent,
PI.RetryAttempt AS PIRetry,
PI.Tags AS PITag,
SELECT XMLAGG( XMLELEMENT( "PO", XMLFOREST( PO.option_id AS POoid,
PO.question_id AS POqid,
PO.process_id AS popid,
PO.opt_innertext AS POtext,
PO.opt_linkfrom AS POfrom,
PO.opt_linkto AS POto,
PO.libquestion_idfk AS POlqid,
PO.liboption_idfk AS POloid ) ) )
FROM vw_liveProcessOption_Sim_v6 PO
WHERE PI.question_id = PO.question_id (+)
AND PI.process_id = PO.process_id (+)
) "A" ) ) ) AS "PO"
FROM vw_liveProcessItem_Sim_v6 PI
WHERE P.process_id = PI.process_id
) "A" ) ) ) AS "PI"
FROM liveProcess_ec P
WHERE (P.process_id = 450)
Any help really appreciated.
Thanksuser512743 wrote:
Hi,
Here below is the scripts of tables, insert statements and Required output.
CREATE TABLE VW_LIVEPROCESSOPTION_SIM_v6
( "OPTION_ID" NUMBER,
"QUESTION_ID" NUMBER(10,0),
"PROCESS_ID" NUMBER(10,0),
"OPT_INNERTEXT" VARCHAR2(200 CHAR),
"OPT_LINKFROM" VARCHAR2(20 CHAR),
"OPT_LINKTO" VARCHAR2(20 CHAR),
"LIBQUESTION_IDFK" NUMBER,
"LIBOPTION_IDFK" NUMBER
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,2,450,'Yes',null,'5',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,3,450,'Yes',null,'5',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,5,450,'Yes',null,'6',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,6,450,'Yes',null,'7',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,8,450,'Block All',null,'9',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,9,450,'Yes',null,'10',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,11,450,'Yes',null,'12',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,12,450,'Yes',null,'13',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,14,450,'Yes',null,'16',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,2,450,'No',null,'3',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,3,450,'No',null,'4',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,5,450,'No',null,'8',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,6,450,'No',null,'8',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,8,450,'Standard',null,'11',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,9,450,'No',null,'11',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,11,450,'No',null,'14',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,12,450,'No',null,'14',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,14,450,'No',null,'15',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (3,8,450,'Disabled',null,'12',null,null);
Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (4,8,450,'User Defined',null,'12',null,null);
REATE TABLE "VW_LIVEPROCESSITEM_SIM_v6"
( "QUESTION_ID" NUMBER(10,0),
"PROCESS_ID" NUMBER(10,0),
"INNERTEXT" VARCHAR2(200 CHAR),
"ITEMTYPE" VARCHAR2(50 CHAR),
"LINKFROM" VARCHAR2(500 CHAR),
"LINKTO" VARCHAR2(500 CHAR),
"ASSOCIATED" VARCHAR2(200 CHAR),
"CONTENT_ID" NUMBER,
"EXITPOINT1_ID" NUMBER(10,0),
"EXITPOINT2_ID" NUMBER(10,0),
"EXITPOINT3_ID" NUMBER(10,0),
"RESOLVEIDENTIFIER" VARCHAR2(40 CHAR),
"LIBQUESTION_IDFK" NUMBER(10,0),
"FOLLOWONCALL" NUMBER(1,0),
"USERINPUT" VARCHAR2(200 CHAR),
"ISLOCKED" NUMBER(1,0),
"PREVIOUSANSWER" NUMBER(1,0),
"VISIBLETOAGENT" NUMBER(1,0),
"RETRYATTEMPT" NUMBER(10,0),
"TAGS" VARCHAR2(50 BYTE)
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (1,450,'CBB1015 - Router Firewall Settinngs Process','Title',null,'2',null,null,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (2,450,'Is the customers PC Firewall turned off?','Question','1','2.2,2.1',null,null,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (3,450,'Advise the customer to turn off the PC Firewall in order to continue. Has this been done?','Question','2.2','3.2,3.1',null,278,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (4,450,'Advise the customer the PC Firewall must be switched off before this process????','ExitPoint','3.2',null,null,null,14,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (5,450,'Is the customer able to access the internet now?','Question','3.1,2.1','5.2,5.1',null,null,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (6,450,'Is the customer having a problem with a specific website?','Question','5.1','6.2,6.1',null,null,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (7,450,'1536: CBB1008 - Browser Setup and Daignostics','SubProcess','6.1',null,'1536-1-0',null,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (8,450,'What is the security level on the CPE Management page?','Question','6.2,5.2','8.4,8.3,8.2,8.1',null,279,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (9,450,'Change the security level to Standard. Does this resolve the customers issue?','Question','8.1','9.2,9.1',null,280,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (10,450,'Issue Resolved','ExitPoint','9.1',null,null,null,1,6,122,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (11,450,'Change the security level to Disabled. Is the customer able to browse the internet?','Question','9.2,8.2','11.2,11.1',null,281,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (12,450,'Change the security level to Standard. Is the customer able to browse the internet now?','Question','11.1,8.3,8.4','12.2,12.1',null,283,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (13,450,'Issue Resolved','ExitPoint','12.1',null,null,null,1,6,123,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (14,450,'Ask the customer to perform a master reset. Does this resolve their issue?','Question','12.2,11.2','14.2,14.1',null,282,null,null,null,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (15,450,'Faulty CPE','ExitPoint','14.2',null,null,null,1,6,124,null,null,null,null,null,null,null,null,null);
Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (16,450,'Issue Resolved','ExitPoint','14.1',null,null,null,1,6,123,null,null,null,null,null,null,null,null,null);
CREATE TABLE "LIVEPROCESS_EC_V"
( "PROCESS_ID" NUMBER(10,0),
"USER_ID" NUMBER(10,0),
"CREATED" TIMESTAMP (6)
Insert into LIVEPROCESS_EC (PROCESS_ID,USER_ID,CREATED) values (450,7460,to_timestamp('21-APR-08 09.34.41.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'));
Required O/P in XML format
<P>
<Ppid>450</Ppid>
<PI>
<PIqid>1</PIqid>
<PIpid>450</PIpid>
<PItext>CBB1015 - Router Firewall Settinngs Process</PItext>
<PItype>Title</PItype>
<PIto>2</PIto>
<PO />
</PI>
<PI>
<PIqid>2</PIqid>
<PIpid>450</PIpid>
<PItext>Is the customers PC Firewall turned off?</PItext>
<PItype>Question</PItype>
<PIfrom>1</PIfrom>
<PIto>2.2,2.1</PIto>
<PO>
<POoid>1</POoid>
<POqid>2</POqid>
<popid>450</popid>
<POtext>Yes</POtext>
<POto>5</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>2</POqid>
<popid>450</popid>
<POtext>No</POtext>
<POto>3</POto>
</PO>
</PI>
<PI>
<PIqid>3</PIqid>
<PIpid>450</PIpid>
<PItext>Advise the customer to turn off the PC Firewall in order to continue. Has this been done?</PItext>
<PItype>Question</PItype>
<PIfrom>2.2</PIfrom>
<PIto>3.2,3.1</PIto>
<PIc>278</PIc>
<PO>
<POoid>1</POoid>
<POqid>3</POqid>
<popid>450</popid>
<POtext>Yes</POtext>
<POto>5</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>3</POqid>
<popid>450</popid>
<POtext>No</POtext>
<POto>4</POto>
</PO>
</PI>
<PI>
<PIqid>4</PIqid>
<PIpid>450</PIpid>
<PItext>Advise the customer the PC Firewall must be switched off before this process????</PItext>
<PItype>ExitPoint</PItype>
<PIfrom>3.2</PIfrom>
<PIe1>14</PIe1>
<PO />
</PI>
<PI>
<PIqid>5</PIqid>
<PIpid>450</PIpid>
<PItext>Is the customer able to access the internet now?</PItext>
<PItype>Question</PItype>
<PIfrom>3.1,2.1</PIfrom>
<PIto>5.2,5.1</PIto>
<PO>
<POoid>1</POoid>
<POqid>5</POqid>
<popid>450</popid>
<POtext>Yes</POtext>
<POto>6</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>5</POqid>
<popid>450</popid>
<POtext>No</POtext>
<POto>8</POto>
</PO>
</PI>
<PI>
<PIqid>6</PIqid>
<PIpid>450</PIpid>
<PItext>Is the customer having a problem with a specific website?</PItext>
<PItype>Question</PItype>
<PIfrom>5.1</PIfrom>
<PIto>6.2,6.1</PIto>
<PO>
<POoid>1</POoid>
<POqid>6</POqid>
<popid>450</popid>
<POtext>Yes</POtext>
<POto>7</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>6</POqid>
<popid>450</popid>
<POtext>No</POtext>
<POto>8</POto>
</PO>
</PI>
<PI>
<PIqid>7</PIqid>
<PIpid>450</PIpid>
<PItext>1536: CBB1008 - Browser Setup and Daignostics</PItext>
<PItype>SubProcess</PItype>
<PIfrom>6.1</PIfrom>
<PIas>1536-1-0</PIas>
<PO />
</PI>
<PI>
<PIqid>8</PIqid>
<PIpid>450</PIpid>
<PItext>What is the security level on the CPE Management page?</PItext>
<PItype>Question</PItype>
<PIfrom>6.2,5.2</PIfrom>
<PIto>8.4,8.3,8.2,8.1</PIto>
<PIc>279</PIc>
<PO>
<POoid>1</POoid>
<POqid>8</POqid>
<popid>450</popid>
<POtext>Block All</POtext>
<POto>9</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>8</POqid>
<popid>450</popid>
<POtext>Standard</POtext>
<POto>11</POto>
</PO>
<PO>
<POoid>3</POoid>
<POqid>8</POqid>
<popid>450</popid>
<POtext>Disabled</POtext>
<POto>12</POto>
</PO>
<PO>
<POoid>4</POoid>
<POqid>8</POqid>
<popid>450</popid>
<POtext>User Defined</POtext>
<POto>12</POto>
</PO>
</PI>
<PI>
<PIqid>9</PIqid>
<PIpid>450</PIpid>
<PItext>Change the security level to Standard. Does this resolve the customers issue?</PItext>
<PItype>Question</PItype>
<PIfrom>8.1</PIfrom>
<PIto>9.2,9.1</PIto>
<PIc>280</PIc>
<PO>
<POoid>1</POoid>
<POqid>9</POqid>
<popid>450</popid>
<POtext>Yes</POtext>
<POto>10</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>9</POqid>
<popid>450</popid>
<POtext>No</POtext>
<POto>11</POto>
</PO>
</PI>
<PI>
<PIqid>10</PIqid>
<PIpid>450</PIpid>
<PItext>Issue Resolved</PItext>
<PItype>ExitPoint</PItype>
<PIfrom>9.1</PIfrom>
<PIe1>1</PIe1>
<PIe2>6</PIe2>
<PIe3>122</PIe3>
<PO />
</PI>
<PI>
<PIqid>11</PIqid>
<PIpid>450</PIpid>
<PItext>Change the security level to Disabled. Is the customer able to browse the internet?</PItext>
<PItype>Question</PItype>
<PIfrom>9.2,8.2</PIfrom>
<PIto>11.2,11.1</PIto>
<PIc>281</PIc>
<PO>
<POoid>1</POoid>
<POqid>11</POqid>
<popid>450</popid>
<POtext>Yes</POtext>
<POto>12</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>11</POqid>
<popid>450</popid>
<POtext>No</POtext>
<POto>14</POto>
</PO>
</PI>
<PI>
<PIqid>12</PIqid>
<PIpid>450</PIpid>
<PItext>Change the security level to Standard. Is the customer able to browse the internet now?</PItext>
<PItype>Question</PItype>
<PIfrom>11.1,8.3,8.4</PIfrom>
<PIto>12.2,12.1</PIto>
<PIc>283</PIc>
<PO>
<POoid>1</POoid>
<POqid>12</POqid>
<popid>450</popid>
<POtext>Yes</POtext>
<POto>13</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>12</POqid>
<popid>450</popid>
<POtext>No</POtext>
<POto>14</POto>
</PO>
</PI>
<PI>
<PIqid>13</PIqid>
<PIpid>450</PIpid>
<PItext>Issue Resolved</PItext>
<PItype>ExitPoint</PItype>
<PIfrom>12.1</PIfrom>
<PIe1>1</PIe1>
<PIe2>6</PIe2>
<PIe3>123</PIe3>
<PO />
</PI>
<PI>
<PIqid>14</PIqid>
<PIpid>450</PIpid>
<PItext>Ask the customer to perform a master reset. Does this resolve their issue?</PItext>
<PItype>Question</PItype>
<PIfrom>12.2,11.2</PIfrom>
<PIto>14.2,14.1</PIto>
<PIc>282</PIc>
<PO>
<POoid>1</POoid>
<POqid>14</POqid>
<popid>450</popid>
<POtext>Yes</POtext>
<POto>16</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>14</POqid>
<popid>450</popid>
<POtext>No</POtext>
<POto>15</POto>
</PO>
</PI>
<PI>
<PIqid>15</PIqid>
<PIpid>450</PIpid>
<PItext>Faulty CPE</PItext>
<PItype>ExitPoint</PItype>
<PIfrom>14.2</PIfrom>
<PIe1>1</PIe1>
<PIe2>6</PIe2>
<PIe3>124</PIe3>
<PO />
</PI>
<PI>
<PIqid>16</PIqid>
<PIpid>450</PIpid>
<PItext>Issue Resolved</PItext>
<PItype>ExitPoint</PItype>
<PIfrom>14.1</PIfrom>
<PIe1>1</PIe1>
<PIe2>6</PIe2>
<PIe3>123</PIe3>
<PO />
</PI>
</P>
Thanks in advance
Edited by: user512743 on Nov 18, 2008 4:46 AM -
Hi,
I am trying to do a right outer join between 2 tables say a and b, and I specify the following condition in the joiner as follows, say
a.deptno(+) = b.deptono. But it throws an error during deployment as follows
PL/SQL: ORA-25156: old style outer join (+) cannot be used with ANSI joins.
I am using OWB Release 10.2(Paris)
Your help would be appreciated.
regards,
varshaHi
Check the generated code from the mapping, or the internediate result in the mappings output group.
Maybe you should use new oter join definitions:
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm#sthref3175
Ott Karesz
http://www.trendo-kft.hu -
How can we make consecutive left outer joins in Composite Provider?
Hi,
For the following design:
Sales order and Delivery DSO's are unions on field Delivery Number.
Invoice(Billing DSO) is having left outer join and joins with Sales Order DSO's based on the field Sales Order Number.
Shipment DSO has left outer join, joins with Invoice DSO based on Delivery number.
My doubt here in this composite provider design, is more than one consecutive left outer joins(in Invoice, shipment dso join) are allowed?
Since this is possible in SAP ERP through writing abap codes, I came across that this kind of modelling is not possible in BW on Hana through Composite provide kindly suggest how can we achieve this design in SAP BW On hana.
Regards,
Antony Jerald.Hi,
Could anyone please help me on this?
Hope, you are able to understand my question. Please suggest.
Regards,
Antony Jerald. -
I would like to know how i can rewrite this statement below in ANSI-92 standard:
SELECT A.COMMON_COL1, B.COMMON.COL2 FROM
TABLE_A.COMMON_COL1 A,
TABLE_B.COMMON_COL2 B
WHERE TABLE_A.COMMON_COL1(+) = TABLE_B.COMMON_COL2;Many Thanks.FROM table_a a JOIN table_b b ON a.fk=b.pk
or
FROM (SELECT fk, other_col FROM table_a) a
JOIN (SELECT pk, other_other_col FROM table_b) b ON a.fk = b.pk -
How can we make an outer join (+) between 2 Queries
in the data model, i have 2 queries
i.e
Q_master and Q_detail
i want to make a data link between
these two queries and
also make an outer join between these
two queries(i.e. to display all the detail
records, whether they have details or not)
please reply is it possible ?
if yes then how?
plz write.
[email protected]
nullHello,
Left outer join behavior is what you get by default with a link between two queries in Reports.
If you want a full outer join behavior, you'll need to create a third query that selects the detail records that have no corresponding master, and also create an extra layout region to display them in as a default group left or group above won't pick up these extra records.
If you want right outer join behavior, you'll need to put in a summary in the master query that counts the rows in the detail, and then put in a format trigger in the master repeating frame that suppresses printing when there are no detail records. And you'll also need the third query and layout section as in the full outer join case.
Regards,
The Oracle Reports Team --skw -
Join-types right & full outer join with Datasets
Hello
I use Crystal Reports XI Release 2 with ADO.NET Datasets as datasource. In the "Database-Expert" I try to set the "Link-Options". Unfortunately are the join-types "right outer join" and "full outer join" disabled.
- Is this because of the datasource Dataset?
- Is there e possibility to build the Dataset so I can use this two joins?
- If not, is it possible in a newer version?
Thanks, T.FitziHi
I think this is the problem. I don't connect directly to a database. My application (C#) provieds Crystal Report with a dataset. So all my data is in this dataset.
Are this joins in the new version stil disabled?
Regards, Thomas -
What is left join /right join / out join/ inner join/please give example!
what is left join /right join / out join/ inner join/please give example!
thanksMaybe these examples will give you an idea...
SQL> select * from t1;
ID
1
2
3
4
SQL> select * from t2;
ID
3
4
5
6
-- LEFT OUTER JOIN
SQL> select t1.id, t2.id
2 from t1 LEFT OUTER JOIN t2 ON (t1.id = t2.id);
ID ID
3 3
4 4
1
2
-- RIGHT OUTER JOIN
SQL> select t1.id, t2.id
2 from t1 RIGHT OUTER JOIN t2 ON (t1.id = t2.id);
ID ID
3 3
4 4
6
5
-- LEFT JOIN (SAME AS LEFT OUTER JOIN)
SQL> ed
Wrote file afiedt.buf
1 select t1.id, t2.id
2* from t1 LEFT JOIN t2 ON (t1.id = t2.id)
SQL> /
ID ID
3 3
4 4
1
2
-- RIGHT JOIN (SAME AS RIGHT OUTER JOIN)
SQL> ed
Wrote file afiedt.buf
1 select t1.id, t2.id
2* from t1 RIGHT JOIN t2 ON (t1.id = t2.id)
SQL> /
ID ID
3 3
4 4
6
5
-- INNER JOIN (REGULAR JOIN)
SQL> ed
Wrote file afiedt.buf
1 select t1.id, t2.id
2* from t1 INNER JOIN t2 ON (t1.id = t2.id)
SQL> /
ID ID
3 3
4 4
-- FULL OUTER JOIN
SQL> ed
Wrote file afiedt.buf
1 select t1.id, t2.id
2* from t1 FULL OUTER JOIN t2 ON (t1.id = t2.id)
SQL> /
ID ID
3 3
4 4
1
2
6
5
6 rows selected.
SQL> -
I have the following table structure,
Table - 1_
ID | Information
1 | abcadskasasa
2 | asdasdasdasd
3 | saeqdfdvsfcsc
Table - 2_
ID | PID
1 | 12
1 | 13
2 | 14
1 | 15
1 | 16
2 | 12
Table - 3_
ID | PARID
1 | 12
2 | 14
1 | 15
Now I want to select for each ID in table 1, the count of number of PID from table 2 and count of number of PARID from table 3.
Desired output:_
ID | COUNT_PID | COUNT_PARID
1 | 4 | 2
2 | 2 | 1
3 | 0 | 0
Could anyone please help me out with this. I am trying to make use of outer joins, but as I work mostly on the front end so, not able to come up with a proper solution for the above.
Thanks in advance,
TejasHi, Tejas,
You might have been doing the outer join correctly.
There's another problem here: joining table_1 to two other tables with which it has a one-to-many relationship.
If you were joining table_1 to just one other table, you could say:
SELECT t1.id
, COUNT (t2.pid) AS count_pid
FROM table_1 t1
LEFT OUTER JOIN table_2 t2 ON t1.id = t2.id
GROUP BY t1.id
ORDER BY t1.id;You could have done the exact same thing with table_3 instead of table_2.
But you can't do the same thing with both table_2 and table_3 at the same time: that would be like cross-joining table_2 and table_3. Instead of showing id=1 having count_pid=4 and count_parid=2, you would get cout_pid=8 and count_parid=8 (since 8 = 4 * 2).
You can do a separate GROUP BY on (at least) one of the tables.
This gets the right results. In the main query, there is only one one-to-many relationship.
WITH t3_summary AS
SELECT id
, COUNT (parid) AS count_parid
FROM table_3
GROUP BY id
SELECT t1.id
, COUNT (t2.pid) AS count_pid
, MAX (t3.count_parid) AS count_parid
FROM table_1 t1
LEFT OUTER JOIN table_2 t2 ON t1.id = t2.id
LEFT OUTER JOIN t3_summary t3 ON t1.id = t3.id
GROUP BY t1.id
ORDER BY t1.id; -
SQL Query Assistance Required for Full Outer Join
Hi,
Lets say I have two tables, i.e:
TAB_A (colA1, colA2, colA3, colA4)
TAB_B (colB1, colB2, colB3, colB4) where colB2 is a FK to colA1
I am after an SQL query that will cater for both the following two scenarios.
Scenario 1:
TAB_A has two rows of data, i.e
(1, ABC100, 1, WG_A)
(2, ABC100, 2, WG_B)
TAB_B has one row of data, i.e
(1, 1, EMP_222, 4)
I use the following SQL:
select a.*, b.*
from tab_a a FULL OUTER JOIN tab_b b ON (a.colA1 = b.colB2)
where a.colA2 = 'ABC100'
This returns two rows:
1, ABC100, 1, WG_A, 1, 1, EMP_222, 4
2, ABC100, 2, WG_B
Now, what I actually would like my query to do is actually only return the row where a tab_b record exists, i.e, should only return one record:
1, ABC100, 1, WG_A, 1, 1, EMP_222, 4
This I can achieve by using a RIGHT OUTER JOIN instead above, but this causes issue with my scenario 2, which is the following set-up
Scenario 2:
TAB_A has only one row of data this time, i.e
(2, ABC100, 2, WG_B)
TAB_B has no data at all this time
This returns no rows but I actually now want this single record from tab_a returned.
I basically require an SQL query that will cater for both the top 2 scenarios, i.e, if a tab_b record exists from the outer join then only return this record along with tab_a data. If a tab_b record doesn't exist, then only return the tab_a record.
Hope the above makes sense.
Thanks.Is it what you need (not very elegant) ?
SQL> select * from t_outer;
ID CODE
1 100
2 100
SQL> select * from t_inner;
no rows selected
SQL> with tab1 as (
2 select a.id a_id, a.code, b.id b_id from t_outer a join t_inner b on
3 (a.id = b.id and a.code = '100'))
4 select * from tab1
5 union all
6 select a.*, null from t_outer a where not exists (
7 select 1 from tab1)
8 and a.code = '100'
9 /
A_ID CODE B_ID
1 100
2 100
SQL> insert into t_inner values(2);
1 row created.
SQL> with tab1 as (
2 select a.id a_id, a.code, b.id b_id from t_outer a join t_inner b on
3 (a.id = b.id and a.code = '100'))
4 select * from tab1
5 union all
6 select a.*, null from t_outer a where not exists (
7 select 1 from tab1)
8 and a.code = '100'
9 /
A_ID CODE B_ID
2 100 2
Rgds. -
Hi,
I have a Fact table which is joined with two Dim tables:
FACT -----DIM1 (FACT.key_col1= DIM1.key_col(+) )
\__DIM2 (FACT.key_col2= DIM2.key_col(+) )
Logical column:
col1 = DECODE(DIM2.val, 0, DIM2.desc, DIM1.desc)
In the business model:
FACT >----- DIM1 (Right Outer Join)
v
\___ DIM2 (Right Outer Join)
- In the LTS of DIM2, I have only DIM2 and in "General Tab\Map to these tables":
1. FACT - DIM2 : Right Outer Join
2. FACT - DIM1 : Right Outer Join
- In the "Column Mapping" of DIM2, I have:
col1 = CASE WHEN DIM2.val = 0 THEN DIM2.desc ELSE DIM1.desc END
The problem comes when I make a report with only one column from DIM2 (different from col1), for example: DIM2.name, OBIEE generates a query like this:
SELECT
DIM2.name
FROM
FACT,
DIM1,
DIM2
WHERE
FACT.key_col1= DIM1.key_col(+)
AND FACT.key_col2= DIM2.key_col(+)
The correct query should be:
SELECT
DIM2.name
FROM
FACT
DIM2
WHERE
FACT.key_col2= DIM2.key_col(+)
I have detected that if "INNER" type join is used, OBIE doesn't add a table that is not referenced in the report (in this case DIM1).
How can I make OBIEE generate the second query?
Thanks in advance,
RegardsTry this
http://obiee101.blogspot.com/2008/11/obiee-outerjoin-workaround.html
Regards,
Raghu -
Left Outer Joining multiple tables to one source table FAILS with VLD-1511
Hi all,
Is it me, or is OWB unable to handle left outer joining 1 source table to multiple other tables?
I want to load a fact table so I have 1 source table with measures. This table must be outer joined to some dimensions that have their FK in the fact table.
The SQL statement would look like this (and is perfectly valid):
select ...
from input, dim1, dim2
where input.c1 = dim1.c1(+)
and input.c2 = dim2.c2(+);
I put the where clause in the joiner operator and validate, but that gives me message VLD-1511: A table may be outer joined to at most one other table.
Even splitting this up into one outer join per joiner still gives this message.
A search and look around on the forum and on metalink shows there are related issues (like bug 3334035). Seemingly creating a view is the work-around to use.....? (ie downgrading owb to a simple gui tool) }-;
Have other people experienced this problem of not being able to outer join one input table to multiple other tables?
Thanks,
EdI have had some feedback from Oracle. It turns out this has to do with 2 issues. Below I have pasted the text that Support gave me:
<---------- START QUOTE ---------->
RESEARCH
=========
Bug 3437036 KEY LOOKUP DOES NOT DETECT ORA-1417 IN VALIDATE/GENERATE STEP
Unpublished Bug 4211684 FORWARD PORT OF BUG 3437036
shows:
Some more development has been completed when this bug is fixed in Paris.
The following are the details:
1. If the join condition contains a full outer join such as
tab1.c (+) = tab2.c (+) and tab2.c (+) = tab3.c
then the new validations implemented for this bug do not apply since
in OWB, full outer join triggers generation of joins in ANSI syntax.
ANSI syntax does not have the original problem the base bug of this
bug reported.
2. If the join condition does not contain any full outer join condition,
then the join is generated in Oracle join syntax, which is subject two
several restrictions. The fix to this bug check two of the restrictions.
3. The first restriction in Oracle syntax is that the outer join operator
"(+)" can only directly be attached to a column name. If you attach it
to an expression, such as the following:
(tab1.c + 1) (+) = tab2.c
Then there will be an ORA-936 error at the time of mapping deployment.
For this case, I have added a validation message VLD-1512 to error out
this situation.
4. The second restriction in Oracle syntax is that a table can only be
outer joined to exactly one other table.
For example, this is an invalid join in Oracle syntax:
tab1.c (+) = tab2.c and tab1.d (+) = tab3.d
because tab1 is left outer joined to tab2 and tab3.
But note that the following is still valid in Oracle syntax:
tab1.c (+) = tab2.c and tab1.d = tab3.d (+)
because tab1 is left outer joined to tab2 and right outer joined to tab3.
So this latter case does not violate the restriction that "same oj" to
more than 1 table is not allowed.
If same oj to more than 1 table is specified in a join condition,
VLD-1511 will be issued, and the map is made invalid.
<---------- END QUOTE ---------->
OWB does a partial validation, ie not all access paths are (can be) checked. A full check is only done by the database itself. So some scenarios (like checking whether multiple tables are outer joined the correct way) are not checked, and in this case are flagged with an error (even though it is actually a correct scenario).
Seemingly this was not flagged with an error in earlier versions of OWB, so beware, OWB behaviour may change when upgrading...
Alternative solutions are (1) using key lookups, (2) using a view with all outer joins in there, (3) using intermediate result tables between the joins.
Hope this info helps some people prevent spending too much time on a false error message,
Ed
Maybe you are looking for
-
SAP BPC 7 APPSet Restore SQL 2005
Hi Everyone, I have SAP BPC 7 setup in a multi-server environment, and it's working well. I created a dev environment, installed SAP in the same fashion, and now when I try to restore an app set through server manager in dev, it keeps putting the SQL
-
AP Credit Memo and Purchase Order
Hi, can anyone tell me if it's possible to link a AP Credit Memo to a purchase order like an invoice can joined to ? thanks
-
Calling MS Access queries from Java
Anyone have any idea if it's possible to call MS Access queries from Java? I have a client who is insistent on keeping MS Access for their database, and it'd be nice if I didn't have to receate all their queries in Java. I've successfully connected t
-
Validation of Material group replication
Hi, How do I validate ( the number of material group in R/3 and SRM) whether I have replicated all the material groups to SRM ? With regards, Pranav
-
ITunes Crash - Cannot re-install iTunes
Okay so just today my iTunes stoped working, so I just constantly clicked on the iTunes and it kept producing an error saying that iTunes has chashed upon opening iTunes, so I drag it to the trash, but that doesn't help. So I deleted iTunes and opene