Outer join doesn work
The prob with this query is, it has to list the pono for grnno,which contains null value,but outer join doesn work on this, and it list values only for grnno that contains value please help to solve this prob
SELECT pv.vendor_name, pv.segment1 vendorid, ph.segment1 pono, pl.line_num,
ph.creation_date po_date, pl.quantity orderqty,
pll.quantity_received, pl.unit_price, rcv.receipt_num grn_no,
rct.creation_date item_recd_date, rct.quantity, ph.currency_code,
item.segment1 itemcode, pl.item_description description,
ph.attribute1 po_type
FROM po_headers_all ph,
po_lines_all pl,
po_vendors pv,
po_line_locations_all pll,
rcv_shipment_headers rcv,
rcv_transactions rct,
mtl_system_items item
WHERE item.inventory_item_id = pl.item_id
AND item.organization_id = pl.org_id
AND ph.authorization_status IN ('APPROVED')
AND NVL (ph.cancel_flag, 'N') = 'N'
AND NVL (pl.cancel_flag, 'N') = 'N'
AND pl.po_header_id = pll.po_header_id
AND pl.po_line_id = pll.po_line_id
AND pl.org_id = pll.org_id
AND rcv.shipment_header_id = rct.shipment_header_id
AND pl.po_header_id = rct.po_header_id
AND rct.po_line_id = pl.po_line_id(+)
AND pl.po_header_id = ph.po_header_id
AND pv.vendor_id = ph.vendor_id(+)
AND TRUNC (ph.creation_date) >= '06-MAY-2006'
AND TRUNC (ph.creation_date) <= '29-MAY-2006'
AND rct.transaction_type = 'RECEIVE'
ORDER BY pono
This is one that always confuses me - do you need to outer join all references to the table? ie :
1 select d.deptno,d.dname
2 ,e.empno,e.ename
3 from dept d,emp e
4 where d.deptno = e.deptno(+)
5 and d.dname like '%S%'
6* and e.ename like '%A%'
SQL> /
DEPTNO DNAME EMPNO ENAME
30 SALES 7499 ALLEN
30 SALES 7521 WARD
30 SALES 7654 MARTIN
30 SALES 7698 BLAKE
20 RESEARCH 7876 ADAMS
30 SALES 7900 JAMES
6 rows selected.
SQL> edit
Wrote file afiedt.buf
1 select d.deptno,d.dname
2 ,e.empno,e.ename
3 from dept d,emp e
4 where d.deptno = e.deptno(+)
5 and d.dname like '%S%'
6* and e.ename(+) like '%A%'
SQL> /
DEPTNO DNAME EMPNO ENAME
20 RESEARCH 7876 ADAMS
30 SALES 7654 MARTIN
30 SALES 7900 JAMES
30 SALES 7521 WARD
30 SALES 7499 ALLEN
30 SALES 7698 BLAKE
40 OPERATIONS
60 TEST
70 TEST
9 rows selected.
Similar Messages
-
Left Outer Join Not working in BI 7.0 Infoset
Hi All,
I am working on BI 7.0. I have to create a report where I have to display the Target values from a target DSO against the transactional data (Operational data).
I have a DSO where for a subteam value target has been set up on different KPIs.
In the Info Cube, I have transactional data on daily basis per subteam. I have to show the actual and target values.
I have created an Info Set using Target DSO and Daily operational cube, so that I should able to compare the target and actual values of KPIs, for all the subteam values (From DSO, irrespective of whether the data is available in cube for those sub team).
I have used Outer Left Join in the Info set (DSO on left side), but I am unable to see the desired results. It is working just like an inner join.
Any Idea why the Outer Left Join is not working? The DSO has only one fey field called subteam on which I have set outer left join.
Regards,
AmitHi,
did you solve your problem? because I have the same issue right now: the left outer join doesn't seem to do its job.
Let me know if you have found a solution, it would be appreciated.
have a nice day,
Dominic -
Outer join not working when filters are applied from Prompts
Hi,
Without values being selected from the dashboard prompts, my outer join is working fine with all the rows and all the columns showing up( as per requirement). But as soon as I select values in the prompts, only certain rows and columns show up.
BTW, I have 2 prompts Year and Quarter. I put Year is Prompted or is null in the criteria. It works. BUT as soon as I also put in quarter numbers, it does not work.
Is there a workaround for this?
Thanks,
Dan
Edited by: Danny on Apr 26, 2013 12:10 PMI just experimented by adding is null to not only the year and quarter but to the row and column too and it worked!
Thanks,
Dan -
Why Left Outer Join Doesn't Work?
Hello
I have a query that I want to return all group id's in the grp_id table and count and give me a count of all members that are "active" in the member table. There are some members that are not active in the member table that belong to groups in the grp_id table. I still want a record returned for those grpid's, though since there are no active members for those groups, I would want a zero as the mbr_count. An active mbr is one whose eff_dt is less than today's date and whose exp_dt is greater than todays date.
I have listed the query below, which returns active mbr records, but unfortuntely, does not return the one grpid (as in my sample data) that does not have an active member (grpid: 'D'). I have also provided the DDL for the two tables along with some sample data that gives me the (Incorrect) results I have posted. I have also posted what results I need (the 'Correct' results).
Thanks for any assistance.. (I am using PL/SQL)
QUERY I AM USING:
=============
SELECT
g00.grpid,
count(m00.grpid) mbr_count
FROM
grp_id g00
LEFT OUTER JOIN
mbr m00 on
g00.grpid = m00.grpid
WHERE
m00.eff_dt < sysdate
AND
m00.exp_dt > sysdate
GROUP BY
g00.grpid
it gives me results as:
INCORRECT RESULTS:
===============
GRPID MBR_COUNT
A 2
B 2
C 1
What I want to see is:
CORRECT RESULTS
===============
GRPID MBR_COUNT
A 2
B 2
C 1
D 0
Here is the DDL's and Sample Data:
create table grp_id (grpid varchar(1))
insert into grp_id values ('A')
insert into grp_id values ('B')
insert into grp_id values ('C')
insert into grp_id values ('D')
commit
create table mbr (mbr_name varchar(10), grpid varchar(1), eff_dt date, exp_dt date)
insert into mbr values ('MARK', 'A', to_date('01-01-2011', 'MM-DD-YYYY'), to_date('07-01-2011', 'MM-DD-YYYY'))
insert into mbr values ('MARK', 'A', to_date('07-01-2011', 'MM-DD-YYYY'), to_date('01-01-2012', 'MM-DD-YYYY'))
insert into mbr values ('MARTY', 'A', to_date('01-01-2011', 'MM-DD-YYYY'), to_date('07-01-2011', 'MM-DD-YYYY'))
insert into mbr values ('MARTY', 'A', to_date('07-01-2011', 'MM-DD-YYYY'), to_date('01-01-2012', 'MM-DD-YYYY'))
insert into mbr values ('FRANK', 'B', to_date('01-01-2011', 'MM-DD-YYYY'), to_date('07-01-2011', 'MM-DD-YYYY'))
insert into mbr values ('FRANK', 'B', to_date('07-01-2011', 'MM-DD-YYYY'), to_date('01-01-2012', 'MM-DD-YYYY'))
insert into mbr values ('MARY', 'B', to_date('01-01-2011', 'MM-DD-YYYY'), to_date('07-01-2011', 'MM-DD-YYYY'))
insert into mbr values ('MARY', 'B', to_date('07-01-2011', 'MM-DD-YYYY'), to_date('01-01-2012', 'MM-DD-YYYY'))
insert into mbr values ('JEAN', 'C', to_date('01-01-2011', 'MM-DD-YYYY'), to_date('07-01-2011', 'MM-DD-YYYY'))
insert into mbr values ('JEAN', 'C', to_date('07-01-2011', 'MM-DD-YYYY'), to_date('01-01-2012', 'MM-DD-YYYY'))
insert into mbr values ('NOAM', 'D', to_date('01-01-2011', 'MM-DD-YYYY'), to_date('07-01-2011', 'MM-DD-YYYY'))Thanks for the script, shame about the missing semi-colons :)
Your restrictions on date are implemented as "filter predicates" rather than "join predicates".
i.e. the difference between a WHERE instead of extra ANDs in the JOIN clause.
SQL> SELECT
2 g00.grpid,
3 count(m00.grpid) mbr_count
4 FROM
5 grp_id g00
6 LEFT OUTER JOIN
7 mbr m00 on
8 g00.grpid = m00.grpid
9 WHERE
10 m00.eff_dt < sysdate
11 AND
12 m00.exp_dt > sysdate
13 GROUP BY
14 g00.grpid
15 /
G MBR_COUNT
A 4
B 4
C 2
SQL> SELECT
2 g00.grpid,
3 count(m00.grpid) mbr_count
4 FROM
5 grp_id g00
6 LEFT OUTER JOIN
7 mbr m00 on
8 g00.grpid = m00.grpid
9 AND
10 m00.eff_dt < sysdate
11 AND
12 m00.exp_dt > sysdate
13 GROUP BY
14 g00.grpid;
G MBR_COUNT
D 0
A 4
B 4
C 2
SQL> -
Outer join doesn't retrieve the correct values
Hi, I have a problem to retrieve some data from this query with the outer join:
select count(incident_id),range_2 from
(select range_2 from apps.aaa_table) a,
(Select inc.incident_id,
XXN2B_RESOLUTION_RANGE(2,ROUND(( (TO_DATE(inc.INCIDENT_ATTRIBUTE_7,'dd/mm/yyyy hh24:mi:ss')-inc.INC_RESPONDED_BY_DATE)*24 ),2)) RANGES
,inc.CATEGORY_ID
, inc.INVENTORY_ITEM_ID,
prom_dt.Iptv_Sumptom --S?µpt?µa
FROM cs_incidents_all_b inc,
cs_incidents_all_tl tl,
cs_sr_type_mapping m,
fnd_responsibility resp,
xxntt.xxntt_incidents_support ntt,
xxntt.xxntt_incidents ntt_inc,
xxe.xxe_tt_promitheas_dt prom_dt,
xxe.Xxe_Cs_Int_Sla sla
WHERE inc.incident_id = tl.incident_id
AND tl.LANGUAGE = 'EL'
AND inc.incident_type_id = m.incident_type_id
AND resp.responsibility_key IN (select SV.FLEX_VALUE from fnd_flex_value_sets s, FND_FLEX_VALUES SV
where s.FLEX_VALUE_SET_NAME = 'XXNTT_RESPONSIBILITIES'
AND S.FLEX_VALUE_SET_ID = SV.FLEX_VALUE_SET_ID)
AND m.responsibility_id = resp.responsibility_id
AND resp.end_date is null
AND inc.incident_number = ntt.incident_number(+)
AND inc.incident_number = ntt_inc.incident_number(+)
AND inc.incident_id = prom_dt.incident_id(+)
AND inc.incident_number = sla.Incident_Number(+)
--and TOTAL_INACT_SLA_DURATION not like '%0:00%'
and (inc.INC_RESPONDED_BY_DATE is not null AND INCIDENT_ATTRIBUTE_7 is not null)
) b,
(select * from xxntt_custom_hierarchy
union
select null eidos, null omada, null product_categiory, null category_id, null inv_item_descripiption, null symptom, null tautopoihsh, null inv_item_id from dual
) c
where a.range_2 = b.ranges (+)
and c.INV_ITEM_ID (+) = b.INVENTORY_ITEM_ID
and c.CATEGORY_ID (+) = b.CATEGORY_ID
and c.SYMPTOM (+) = b.IPTV_SUMPTOM
and c.OMADA = 'A'
group by range_2
This query is composed by 3 dataset: a, b, and c
the dataset a is a fixed list of values (LOV): range_2 = '0-2h','2-4h','4-6h','6-8h','8-10h','10-12h','12-14h','14-16h','16-18h','18-20h'
the dataset b retrieve the list of the incident_id's and their related ranges (calculated with the function XXN2B_RESOLUTION_RANGE)
the dataset c is just a filter on the the dataset b to retrieve only the incident_id's who belong to the Group 'A'
Want I want to achieve is this: see always the complete list of values 'range_2' even if I don't have incident_id with a particular range.
For this reason I put the condition: a.range_2 = b.ranges (+)
....but this doesn't work....I see ONLY the incident_id which have the range inside the LOV......instead I want to see also if there are incident_id without a range in the LOV.
Grouping by range_2, I see:
!http://www.freeimagehosting.net/uploads/d900035c11.jpg!
instead of
!http://www.freeimagehosting.net/uploads/99a75dfca4.jpg!
Anybody can help me to understand where is the mistake ???
Thanks in advance
AlexHi, Alex,
Whenever you ask a question, post a little sample data (CREATE TABLE and INSERT statements) for all the tables (relevant columns only), as well as the results you want from that data.
When you post formatted text on this site (and code should always be formatted) type these 6 characters:
{code}
(small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
If you're using a + sign next to some column from table c, then all conditions involving table c need to have a + sign; otherwise, you cancel the effect of the outer join.
Change
and c.OMADA = 'A'to
and c.OMADA (+) = 'A'That may be all you need. If not, post the sample data and your formatted query. -
Dynamic From statement in select query and/or outer join not working
Dear Experts, I have a select query where the select columns are dynamic, the where condition is also dynamic. It is of the below format:
Select (dynamic columns) INTO <wa>
FROM a inner join b on af1 = bf1
inner join c on af2 = cf2......
WHERE (dynamic conditios)
ORDER BY ( dynamic sort condition).
Now I have to include some tables (dynamically depending on the user input) in the inner join statement which will give description for the selected fields. And these database tables may or may no be empty. So in this case, my select query will not return any data if these tables are empty. And I dont want that.
I tried using outer join for the extra tables but it gave me a runtime error. I also tried forming the inner join statement dynamically but it was not supporting.
Kindly give me pointers.
ThanksHey thanks for the reply, but the problem is not solved.
I am already using ( fileds, value) like table in my where condition and the select statement was working properly.
the problem is that now I have to include some tables in the join statement which can be empty and so i want to use Outer join.
But I am getting a runtime error as below:
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SYNTAX', was not
caught in
procedure "ZATSCSNG_RFC_READ_TABLE" "(FUNCTION)", nor was it propagated by a
RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The running ABAP program wanted to execute a SELECT statement whose
WHERE condition was (partly) specified dynamically. The part that is
specified in an internal table at runtime is compared to a field of the
right table of an LEFT OUTER JOIN. Such comparisons are not supported by
all database systems and are therefore not allowed. -
LEFT OUTER JOIN not working as expected
I'm testing a query from the portal. I've got two inputs:
products
{"ProductKey":1,"ProductAlternateKey":"abc","Color":"Red"},
{"ProductKey":2,"ProductAlternateKey":"def","Color":"Blue"},
{"ProductKey":3,"ProductAlternateKey":"ghi","Color":"Blue"}
And temperatures:
{"DeviceId":1,"Temperature":99},
{"DeviceId":2,"Temperature":90},
{"DeviceId":2,"Temperature":99},
{"DeviceId":3,"Temperature":50},
{"DeviceId":4,"Temperature":32}
When I test a query with an (inner) join, I get two rows, one for Red and one for Blue as expected. However, when I change to a LEFT OUTER JOIN, I would expect to get three rows... one for Red, one for Blue, and one for NULL color. However, I only get one
row with a NULL color. Here's the query. Is this a bug or am I misunderstanding?
SELECT DateAdd(second,-5,System.TimeStamp) as WinStartTime
, system.TimeStamp as WinEndTime
, b.Color
, Avg(r.Temperature) as AvgTemperature
, Count(*) as EventCount
FROM temperatures r
LEFT OUTER JOIN products b ON r.DeviceId = b.ProductKey and DATEDIFF(hour,r,b) BETWEEN -6 AND 6
GROUP BY TumblingWindow(second, 5), b.Color
(Please excuse the contrived example, the lack of timestamps, and the 12 hour window... just testing.)
http://artisconsulting.com/Blogs/GregGallowayHi Greg,
Thank you for raising this issue.
We have deployed a fix today that corrects LEFT OUTER JOIN behavior on the in-browser query testing experience.
Can you please confirm that the above query and input sources work for you?
Thanks!
Ziv. -
Hello everybody,
I have a folder based on materialized view (Detailed folder). There is another folder which is based on a table (master folder). i have created a jooin and select option as "outer join on master folder". The join is not working properly. Am i doing asomething wrong. Discoverer version is 10.1.2 and database version is 10.2.0.3. i have been creating outer joins among folders based on tables but i am not sure about whats wrong this time??? materalized view defination is as follows:
CREATE MATERIALIZED VIEW MW
BUILD IMMEDIATE
REFRESH FORCE
START WITH SYSDATE
NEXT TRUNC(SYSDATE+1)+1/4
WITH PRIMARY KEY
AS
SELECT * FROM VIEW
Thanx for your help
Regards,
NajeebSo, let me see if I got this...
You have a table and a materialized view. There is a join between the two, where the table is the master, and the MV is the detail. The join is set to be an outer join on master. Ultimately, you want to see the values in the MV where the join condition is NULL.
What boggles me is that you say the query runs fine in the database, but not in Disco. This could mean that there is a condition in the BA or in the worksheet. But, if that were the case, the condition should show up in the SQL generated by Disco.
It looks like the where clause is the problem. NULL is never equal to anything, so when APPROVEDBY is null, the where clause should fail and no data returned. This explains Disco's behavior, but not SQL's.
Something to try: Create a calculation in the materialized view folder of the business area like:
NVL(APPROVEDBY, -1)
I am assuming that all of your IDs are positive. Then modify the join to use the calculated column. This should convert the NULLS to values, and the report should work. -
Left Outer Join not working in Infoset.
Hello Friends,
I have two ODSes , one for planned data (zplan) and other is billing z ods (zsd_o03).
now the situation is such that in my planned ODS for one sold to party .
SOLD TO MATERRIAL CALMONT PLANNED QUANTIY
14315 100 06.2007 54
14315 200 06.2007 20
14315 300 06.2007 30
14315 400 06.2007 10
But in my Billing ODS iam having for Sold to 14315
SOLD TO MATERRIAL CALMONT ACTUAL QUANTIY
14315 100 06.2007 20
14315 200 06.2007 30
And my Bex ouput should be like
SOLD TO MATERIAL CALMONT planned ACTUAL QUANTIY
14315 100 06.2007 54 20
14315 200 06.2007 20 30
14315 300 06.2007 30 0
14315 400 06.2007 10 0
So for this i made one Infoset and these ODses are linked by Sold_to , Materail,
Calmonth.
First i tried using Inner joing option , but the bottom two lines were not ciming , so used left outer join , and activated and recreated the query but still its showiong me the output same as inner join .. i.e
14315 100 06.2007 54 20
14315 200 06.2007 20 30
So i checked by writing a ABAP code in Se38 , but there its showing me the correct result ..
So please anybody help me out because iam thinking that infoset is the right way to do this kind of reporting , or esle shall i make one ODS and populate it through this ABAP code..
Thanks in advance.Hi , can anybody help me in this regard..
Thanks .. -
Merging two complemental result sets... or OUTER JOINs not working?
Dear experts!
Again I have a very difficult problem for which I ask Your help, but this time I am better prepared than last time and can deliver sample data of my (hopefully not too much) simplified example:
create table Subjects(
pk_id number not null primary key,
title varchar2(128)
create table People(
pk_id number not null primary key,
name varchar2(128)
create table Results(
pk_id number not null primary key,
fk_subjects_id number,
fk_people_id number,
result number
insert into Subjects(pk_id, title) values (1, 'Choosing a recipe')
insert into Subjects(pk_id, title) values (2, 'Shopping ingredients')
insert into Subjects(pk_id, title) values (3, 'Preparations')
insert into Subjects(pk_id, title) values (4, 'Cooking for beginners')
insert into Subjects(pk_id, title) values (5, 'Eating for pros')
insert into Subjects(pk_id, title) values (6, 'Dishwashing for everyone')
insert into Subjects(pk_id, title) values (7, 'Digesting for experts')
insert into Subjects(pk_id, title) values (8, 'Becoming hungry again...')
insert into Subjects(pk_id, title) values (9, 'Redo from start')
insert into People(pk_id, name) values (1, 'Hank')
insert into People(pk_id, name) values (2, 'Cloe')
insert into People(pk_id, name) values (3, 'Mary')
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (1, 1, 1, 2)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (2, 2, 1, 4)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (3, 3, 1, 3)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (4, 9, 1, 5)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (5, 1, 2, 4)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (6, 2, 2, 1)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (7, 3, 2, 5)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (8, 4, 2, 2)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (9, 5, 2, 3)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (10, 6, 2, 2)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (11, 7, 2, 1)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (12, 4, 3, 3)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (13, 5, 3, 5)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (14, 7, 3, 1)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (15, 8, 3, 5)
insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (16, 9, 3, 1)
Please imagine this as an university for amateur cooks. Now I want to present them their performance record/"scorecard", for every student, only with her or his marks. On this performance record there should be a list of all 9 subjects possible to pass, and where students got a result, that result should be filled in. I thought that should be possible to achieve with something like this:
SELECT PEOPLE.NAME, SUBJECTS.TITLE, RESULTS.RESULT FROM RESULTS
JOIN PEOPLE ON PEOPLE.PK_ID = RESULTS.FK_PEOPLE_ID
JOIN SUBJECTS ON SUBJECTS.PK_ID = RESULTS.FK_SUBJECTS_ID
WHERE RESULTS.FK_PEOPLE_ID = 2
But also using (LEFT|RIGHT|FULL) OUTER JOINs here does not help me to get what I want, I always only get
NAME TITLE RESULT
Cloe Choosing a recipe 4
Cloe Shopping ingredients 1
Cloe Preparations 5
Cloe Cooking for beginners 2
Cloe Eating for pros 3
Cloe Dishwashing for everyone 2
Cloe Digesting for experts 1
But I want:
NAME TITLE RESULT
Cloe Choosing a recipe 4
Cloe Shopping ingredients 1
Cloe Preparations 5
Cloe Cooking for beginners 2
Cloe Eating for pros 3
Cloe Dishwashing for everyone 2
Cloe Digesting for experts 1
Cloe Becoming hungry again...
Cloe Redo from start
Without having to fill in empty rows for all students which did not take all exams yet.
Is it possible? If so, how?
Thank You very much in advance and Happy Easter to everyone! :-)
With kind regards,
Chriss
Edited by: user9355711 on 01.04.2010 07:01
Edited by: user9355711 on 01.04.2010 07:28
Edited by: user9355711 on 01.04.2010 07:29Also;
var n number
exec :n := 2;
PL/SQL procedure successfully completed
n
2
select ppl.name, sub.title, res.result
from subjects sub, people ppl, results res
where sub.pk_id = res.fk_subjects_id(+)
and ppl.pk_id = :n
and res.fk_people_id(+) = :n
order by sub.title;
NAME TITLE RESULT
Cloe Becoming hungry again...
Cloe Choosing a recipe 4
Cloe Cooking for beginners 2
Cloe Digesting for experts 1
Cloe Dishwashing for everyone 2
Cloe Eating for pros 3
Cloe Preparations 5
Cloe Redo from start
Cloe Shopping ingredients 1 -
Outer Join doesnt work Y?
Hi All,
Can anybody explain me, Y this outerjoin is not working.
Table TERMINAL_MASTER has got terminal_i, terminal_name 25 terminals are there.
DAY_BOOK table has got terminal_id,amount column is there. everyday it is not all the terminals sends money.
i want to see the result like this all terminals, and who ever sends money i want see the amount, who ever not sends money, i want to see 0 (zero) figure. but im not getting all terminals list, im getting only list of terminals only in daybook table.
select A.terminal_name,SUM(B.amount) from terminal_master A,day_book b
where A.terminal_id = B.terminal_id (+)
and
B.transaction_date = '1-mar-05'
group by
A.terminal_name
Thanks in advance.The reason is that one part of your where condition:
A.terminal_id = B.terminal_id (+) says that matching row in B may or may not be present. If not present, assume the columns coming from table B as having NULL value. while the other part of your where condition:
B.transaction_date = '1-mar-05' says that column transaction_date coming from table B must match the value '1-mar-05'. So, in case when matching row in B is not found, it will assume that columns from B are having a value NULL which cannot satisfy your B.transaction_date condition. That is why you need to tell the system to ignore that condition too (in cases where a matching row in B is not found).
Also, as pointed out earlier, if transaction_date is really a DATE type column, the value that it is compared to ('1-mar-05') must also be of DATE type (use TO_DATE with format to avoid surprises). -
OJ syntax for multi-table left outer join with MS Oracle Driver
I have a multi-table left outer join that works fine in SQL Server ODBC Driver, Oracle ODBC driver 8.01.07.00, but not with Microsoft ODBC Driver for Oracle 2.573.7326.0
SELECT * from { oj A LEFT OUTER JOIN B ON A.col1 = B.col1 LEFT OUTER JOIN C ON A.col1 = C.col1 }
I noticed someone had a similar problem (the proposed solution doesn't work):
http://www.justpbinfo.com/listarchive/msg02874.html
Does anyone know how to get this working with the Microsoft ODBC Driver for Oracle? Or does it just not work?The Microsoft ODBC Driver for Oracle 2.573.7326.0 does perform the same 'fix up' with {oj} in Oracle 8i. The problem is that it doesn't work when joining more than two tables:
This works:
SELECT * from { oj A LEFT OUTER JOIN B ON A.col1 = B.col1}
This doesn't work:
SELECT * from { oj A LEFT OUTER JOIN B ON A.col1 = B.col1 LEFT OUTER JOIN C ON B.col1 = C.col1 }
(The second query will work with the Oracle Oracle ODBC driver, with a bit of tweaking. But I haven't found a way to get it to work with the Microsoft ODBC Driver for Oracle 2.573.7326.0. My suspicion is that it just doesn't work.)
Gavin -
BI 7.0 Infoset - Infocube - Left outer join - query
Hi Expert,
A infoset contain Infocube and ODS, linked with left outer join, common fields are PO,PO item. PO account assignment ODS have three keyfields: PO Doc.,Item,account Assignment .
PO Infocube <b>PO Account Assignment ODS</b>
PO PO item Amt<b>PO Doc. Item AccAssignment Cost object</b>
1000 10 230 <b>1000 10 1 CC1</b>
1001 10 250 <b>1002 10 1 CC1</b>
1002 10 150 <b>1002 10 2 CC2</b>
in BEx result are like this:
1000 10 230 1 CC1
1001 10 250 # #
1002 10 150 1 CC1
1002 10 150 2 CC2 ( amount only duplicated)
The issue was that amount gets duplicated. It only occurs if PO has more than one account assignment.
In report, we want show like this
1000 10 230 1 CC1
1001 10 250 # #
1002 10 150 1 CC1
1002 10 # 2 CC2
Any suggestion or input to overcome this issue?
Thanks,
Saran
Message was edited by:
Saravanan KHi,
did you solve your problem? because I have the same issue right now: the left outer join doesn't seem to do its job.
Let me know if you have found a solution, it would be appreciated.
have a nice day,
Dominic -
Best Practice - Outer Join between Fact and Dim table
Hi Gurus,
Need some advice on the below scenario
I have an OOTB subject area and we have around 50-60 reports based on it. The related subject area Fact and Dim1 table are having inner join.
Now I have a scenario for one report where outer join has to be implemented between Fact and Dim1. Here I am against changing the OOTB subject area join as the outer join will impact the performance of other 50-60 reports.
Can anyone provide any inputs on what is the best way to handle this scenario?
ThanksOk. I tried this:
Driving table : Fact, Left outer join -- didnt work.
Driving table: Dimension D left outer join -- didnt work either
In either the case, I see physical query as D left outer Join on Fact F. and omitting the rows.
And then I tried this -
Driving table: Fact, RIght outer join.
Now, this is giving me error:
Sybase][ODBC Driver]Internal Error. [nQSError: 16001] ODBC error state: 00000 code: 30128 message: [Sybase][ODBC Driver]Data overflow. Increase specified column size or buffer size. [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement. (HY000)
I checked all columns, everything matched with database table type and size.
I am pulling Fact.account number, Dimension.account name, Fact.Measures. I am seeing this error each time I pull Fact.Account number. -
Union among multiple select queries with full outer join
Hello everyone,
I have 3 different select queries (used FULL Outer Join) which work fine. Now I want to add Union to the results among them and pick the selected columns from each query in the final result. while doing so, I am getting an error as "right parenthesis missing". I am quite sure, it is not the real cause. I guess might be issue with the query structure.
select j.pod, j.hostname, portal.hostname,saasc.hostname,a3s.hostname from -- * from
Select J.Pod,J.Hostname, P.Pod Portal_Pod,P.Hostname Portal_Hostname
From Total_Pod J
full outer join Portal_Tmp P On (J.Pod = P.Pod And J.Hostname = P.Hostname) as portal
Union
Select J.Pod,J.Hostname, s.Pod saasc_Pod,s.Hostname saasc_Hostname
From Total_Pod J
full outer join Saasc_Tmp S On (J.Pod = s.Pod And J.Hostname = s.Hostname) as saasc
Union
Select J.Pod,J.Hostname, a.Pod a3s_Pod,a.Hostname a3s_Hostname
From Total_Pod J
Full Outer Join A3s_Tmp A On (J.Pod = A.Pod And J.Hostname = A.Hostname) as a3s
)p.s: select * from (INNER QUERY); also does not work.
Any help appreciated.
Thanks in advance.With T as
(Select J.Pod,J.Hostname, P.Pod Portal_Pod,P.Hostname Portal_Hostname
From Total_Pod J
full outer join Portal_Tmp P On (J.Pod = P.Pod And J.Hostname = P.Hostname) ),
U as
(Select J.Pod,J.Hostname, s.Pod saasc_Pod,s.Hostname saasc_Hostname
From Total_Pod J
full outer join Saasc_Tmp S On (J.Pod = s.Pod And J.Hostname = s.Hostname) ),
V as
(Select J.Pod,J.Hostname, a.Pod a3s_Pod,a.Hostname a3s_Hostname
From Total_Pod J
Full Outer Join A3s_Tmp A On (J.Pod = A.Pod And J.Hostname = A.Hostname) )
Select T.Pod,T.Hostname,nvl(T.Portal_Hostname,'Not Available') portal,nvl(U.Saasc_Hostname,'Not Available') saasc,NVL(V.A3s_Hostname,'Not Available') a3s From T,U,V
Where T.Pod = U.Pod
And U.Pod = V.Pod
And T.Hostname = U.Hostname
And U.Hostname = V.Hostname
Maybe you are looking for
-
Macbook Pro Retina crashing when running Safari and iTunes since Mavericks
Hello everyone. I am starting a new thread even though there seem to be a lot of various crash reports. I have noticed several entire system crashes (never, ever happened on my mac before until I updated to Mavericks) when using iTunes and Safari a
-
I published my iWeb website with an iMac I purchased earlier in the year. I just bought an Intel based iMac a few months ago and when I start up iWeb my website will not come up to edit or add to. I synched up with iDisk, etc so what am I doing wrong
-
I want to cancel my annual subscription of Export PDF,
-
Hello, Ive had my iphone 4 for just over a year now, and I've been very happy with it, until now. Essentially, the camera has died. The iris fails to open and the camera to video icon flickers crazily until the screen blacks out and the "I'm
-
I am supposed to be able to set up Skype to go to call a skype account from a telephone. While this works in most cases, it will not recognize Skype ids starting with "live:" (accounts originally created when Skype started accepting Microsoft account