Two diffferent type of joins on the same table
I have a query that, it seems, requires me to two two different types of joins to the same table.
from table t1
LEFT OUTER JOIN table2 t2
ON t1.col1= t2.col1
and t1.col2 = t2.col2
and t1.col5 = t2.col5
LEFT OUTER JOIN table2 t3
ON t1.col1= t3.col1
and t1.col2 = t3.col2
and t1.col4 = t3.col4
would I run into a problem if I just did:
LEFT OUTER JOIN table2 t2
ON t1.col1= t2.col1
and t1.col2 = t2.col2
and t1.col3 = t2.col3
and t1.col4 = t2.col4
and t1.col5 = t2.col5
And if I go with option 1 and I also create two different types of indexes to accommodate each join, will 10g know which ones to use?
Message was edited by:
user623359
Message was edited by:
user623359
No version number and no statement of what it is you are trying to do ... but one solutions is to use the traditional Oracle syntax and the first part, then wraps it in parentheses turning it into an inline view, and then join that to the next part.
Similar Messages
-
SUM two fileds from different rows from the same table
I would like to SUM two fileds from different rows from the same table but I don't know how to do that.
E.g.
BillingTransactionsIndex CreateDate UserType UserIndex TransType Reference Total Balance
2 6/5/2008 15:02 1 51 1 150 -288.2 -288.2
5 6/8/2008 11:55 1 51 1 157 -1.58674 -289.787
In the table above I want SUM fields Total and Balance for the first row and the the next row SUM 2nd row Total with 1st row Balance
Please help
ThanksSQL> with tbl as
2 (select 1 as ID, 90 as total from dual
3 union all
4 select 2 as ID, 23 as total from dual
5 union all
6 select 3 as ID, 15 as total from dual
7 union all
8 select 4 as ID, 20 as total from dual)
9 select id , total, sum(total) over (order by ID) as balance from tbl
10 /
ID TOTAL BALANCE
1 90 90
2 23 113
3 15 128
4 20 148
SQL> -
Multiple joins on the same table
I'm new to SQL 2005 & C# - I'm a MySQL/PHP crossover.
I'm using s Stored Procedure and I'm trying to do multiple joins onto
one table. I have 6 fields in one table that are foreign keys of
another table:
Table1
id
PrimaryCode
SecondaryCode1
SecondaryCode2
SecondaryCode3
SecondaryCode4
SecondaryCode5
Table 2
id
Title
CommCode
The fields in table 1 (except is obviously) hold the id of a row in
Table 2. When displaying data I want to display "Title" -
"CommCode" for each item in Table 1. I got myself started by
searchig on the net and I have a stored procedure. The obvious
problem is that as it goes through the Query only the last value
remains in place - since each value before it is cleared in the
UNION. How can I do this?? Here's my Stored Procedure:
=====================================
ALTER PROCEDURE GetRegistersSpecific
@SearchTxt int
AS
SELECT
registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
PrimaryCode AS MyID, Title, CommodityCode
FROM registrations
JOIN CommodityCodes ON PrimaryCode = CommodityCodes.id
UNION
SELECT
registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
SecondaryCode1 AS MyID, Title, CommodityCode
FROM registrations
JOIN CommodityCodes ON SecondaryCode1 = CommodityCodes.id
UNION
SELECT
registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
SecondaryCode2 AS MyID, Title, CommodityCode
FROM registrations
JOIN CommodityCodes ON SecondaryCode2 = CommodityCodes.id
UNION
SELECT
registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
SecondaryCode3 AS MyID, Title, CommodityCode
FROM registrations
JOIN CommodityCodes ON SecondaryCode3 = CommodityCodes.id
UNION
SELECT
registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
SecondaryCode4 AS MyID, Title, CommodityCode
FROM registrations
JOIN CommodityCodes ON SecondaryCode4 = CommodityCodes.id
UNION
SELECT
registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
SecondaryCode5 AS MyID, Title, CommodityCode
FROM registrations
JOIN CommodityCodes ON SecondaryCode5 = CommodityCodes.id
WHERE registrations.ID = @SearchTxt
=====================================
ThanksWell, I tried using UNION ALL and got the same response. I also tried doing :
Title AS SecTitle1
Title AS SecTitle2
Title AS SecTitle3
etc...
I get different values in the Output Window when I execute the query,
but as expected it only returns the first value since the script
executes all the way through before it outputs values.
Here's how I'm executing:
while (rdr.Read())
// get the results of each column
string company = (string)rdr["Company"].ToString();
string address1 = (string)rdr["Address1"].ToString();
string address2 = (string)rdr["Address2"].ToString();
string city = (string)rdr["City"].ToString();
string state = (string)rdr["State"].ToString();
string zip = (string)rdr["Zip"].ToString();
string phone = (string)rdr["Phone"].ToString();
string fax = (string)rdr["Fax"].ToString();
string email = (string)rdr["Email"].ToString();
string website = (string)rdr["Website"].ToString();
string feid = (string)rdr["Feid"].ToString();
string businessType = (string)rdr["BusinessType"].ToString();
string contactName = (string)rdr["ContactName"].ToString();
string primaryCode = (string)rdr["PrimTitle"].ToString();
string secondaryCode1 = (string)rdr["SecTitle1"].ToString();
string secondaryCode2 = (string)rdr["SecTitle2"].ToString();
string secondaryCode3 = (string)rdr["SecTitle3"].ToString();
string secondaryCode4 = (string)rdr["SecTitle4"].ToString();
string secondaryCode5 = (string)rdr["SecTitle5"].ToString();
string backUp = (string)rdr["BackupWitholding"].ToString();
string signedName = (string)rdr["SignedName"].ToString();
string signedDate = (string)rdr["SignedDate"].ToString(); -
Opinion needed on best way to map multiple table joins (of the same table)
Hi all
I have a query of the format:
select A.col1, B.col1,C.col1
FROM
MASTER_TABLE A, ATTRIBUTE_TABLE B, ATTRIBUTE_TABLE C
WHERE
A.key1 = B.key1 (+)
AND
A.key1 = C.key1(+)
AND
B.key2(+) = 100001
AND
C.key2(+) = 100002
As you can see, I am joining the master table to the attribute table MANY times over, (over 30 attributes in my actual query) and I am struggling to find the best way to map this efficiently as the comparison for script vs. mapping is 1:10 in execution time.
I would appreciate the opinion of experienced OWB users as to how they would tackle this in a mapping and to see if they use the same approach as I have done.
Many thanks
AdiSELECT external_reference, b.attribute_value AS req_date,
c.attribute_value AS network, d.attribute_value AS spid,
e.attribute_value AS username, f.attribute_value AS ctype,
g.attribute_value AS airtimecredit, h.attribute_value AS simnum,
i.attribute_value AS lrcredit, j.attribute_value AS airlimitbar,
k.attribute_value AS simtype, l.attribute_value AS vt,
m.attribute_value AS gt, n.attribute_value AS dt,
o.attribute_value AS datanum, p.attribute_value AS srtype,
q.attribute_value AS faxnum,
R.ATTRIBUTE_VALUE AS FAXSRTYPE,
s.attribute_value AS extno,
t.attribute_value AS tb, u.attribute_value AS gb
v.attribute_value AS mb, w.attribute_value AS stolenbar,
x.attribute_value AS hcredit, y.attribute_value AS adminbar,
z.attribute_value AS portdate
FROM csi_item_instances a,
csi_iea_values b,
csi_iea_values c,
csi_iea_values d,
csi_iea_values e,
csi_iea_values f,
csi_iea_values g,
csi_iea_values h,
csi_iea_values i,
csi_iea_values j,
csi_iea_values k,
csi_iea_values l,
csi_iea_values m,
csi_iea_values n,
csi_iea_values o,
csi_iea_values p,
csi_iea_values q,
CSI_IEA_VALUES R,
csi_iea_values s,
csi_iea_values t,
csi_iea_values u,
csi_iea_values v,
csi_iea_values w,
csi_iea_values x,
csi_iea_values y,
csi_iea_values z
WHERE a.instance_id = b.instance_id(+)
AND a.instance_id = c.instance_id(+)
AND a.instance_id = d.instance_id(+)
AND a.instance_id = e.instance_id(+)
AND a.instance_id = f.instance_id(+)
AND A.INSTANCE_ID = G.INSTANCE_ID(+)
AND a.instance_id = h.instance_id(+)
AND a.instance_id = i.instance_id(+)
AND a.instance_id = j.instance_id(+)
AND a.instance_id = k.instance_id(+)
AND a.instance_id = l.instance_id(+)
AND a.instance_id = m.instance_id(+)
AND a.instance_id = n.instance_id(+)
AND a.instance_id = o.instance_id(+)
AND a.instance_id = p.instance_id(+)
AND a.instance_id = q.instance_id(+)
AND A.INSTANCE_ID = R.INSTANCE_ID(+)
AND a.instance_id = s.instance_id(+)
AND a.instance_id = t.instance_id(+)
AND a.instance_id = u.instance_id(+)
AND a.instance_id = v.instance_id(+)
AND a.instance_id = w.instance_id(+)
AND a.instance_id = x.instance_id(+)
AND a.instance_id = y.instance_id(+)
AND a.instance_id = z.instance_id(+)
AND b.attribute_id(+) = 10000
AND c.attribute_id(+) = 10214
AND d.attribute_id(+) = 10132
AND e.attribute_id(+) = 10148
AND f.attribute_id(+) = 10019
AND g.attribute_id(+) = 10010
AND h.attribute_id(+) = 10129
AND i.attribute_id(+) = 10198
AND j.attribute_id(+) = 10009
AND k.attribute_id(+) = 10267
AND l.attribute_id(+) = 10171
AND m.attribute_id(+) = 10184
AND n.attribute_id(+) = 10060
AND o.attribute_id(+) = 10027
AND p.attribute_id(+) = 10049
AND q.attribute_id(+) = 10066
AND R.ATTRIBUTE_ID(+) = 10068
AND s.attribute_id(+) = 10065
AND t.attribute_id(+) = 10141
AND u.attribute_id(+) = 10072
AND v.attribute_id(+) = 10207
AND w.attribute_id(+) = 10135
AND x.attribute_id(+) = 10107
AND y.attribute_id(+) = 10008
AND z.attribute_id(+) = 10103
AND external_reference ='07920490103'
If I run this it takes less than a second in TOAD, when mapped in OWB it takes ages. 10:1 is a conservative estimate. In reality it takes 15-20 minutes. CSI_IEA_VALUES has 30 million rows CSI_ITEM_INSTANCES has 500,000 rows.
Hope that helps. I would love to know how others would tackle this query. -
Multiple Join over the same table
Hi all,
I have a question concerning joins...
We are working with Oracle 8i.
Consider I have the following tables t_emp_team and t_emp_names
t_emp_team
emp_id1, emp_id2, emp_id3
2, 7, 9
3, 8, 6
4, 11, 3
5, 10, 9
t_emp_names
emp_id, name
2, Peter
3, Mark
4, Liz
5, Will
Now I want a join selecting all the names to the IDs.
My idea was to use a join query like this:
select
a.emp_id1,
a.emp_id2,
a.emp_id3,
b1.name,
b2.name,
b3.name
from
t_emp_team a,
t_emp_names b1,
t_emp_names b2,
t_emp_names b3
where
a.emp_id1=b1.emp_id(+) and
a.emp_id2=b2.emp_id(+) and
a.emp_id3=b3.emp_id(+)
Obviously this is not possible in Oracle as the results are not correct.
Do you have a different idea other than Subselects for each name? (The real table has 16 IDs meaning we would end up with 16 subselects)
Thanks for your help!
-PeterHi,
Obviously this is not possible in Oracle as the results
are not correct.Why do you think so ?
SQL> select
2 a.emp_id1,
3 a.emp_id2,
4 a.emp_id3,
5 b1.name,
6 b2.name,
7 b3.name
8 from
9 t_emp_team a,
10 t_emp_names b1,
11 t_emp_names b2,
12 t_emp_names b3
13 where
14 a.emp_id1=b1.emp_id(+) and
15 a.emp_id2=b2.emp_id(+) and
16 a.emp_id3=b3.emp_id(+)
17 /
 
EMP_ID1 EMP_ID2 EMP_ID3 NAME NAME NAME
4 11 3 Liz Mark
3 8 6 Mark
5 10 9 Will
2 7 9 Peter
 But it would be correct to use normzlized form
of t_emp_team:
SQL> desc t_emp_team_n
Name Null? Type
TEAM_ID NUMBER
EMP_ID NUMBER
 
SQL> select * from t_emp_team_n;
 
TEAM_ID EMP_ID
1 4
1 11
1 3
2 3
2 8
2 6
3 5
3 10
3 9
4 2
4 7
4 9
 
12 rows selected.
 
Elapsed: 00:00:00.04
SQL> select team_id, a.emp_id, name
2 from t_emp_team_n a, t_emp_names b
3 where a.emp_id = b.emp_id (+)
4 order by 1,3
5 /
 
TEAM_ID EMP_ID NAME
1 4 Liz
1 3 Mark
1 11
2 3 Mark
2 8
2 6
3 5 Will
3 10
3 9
4 2 Peter
4 7
4 9
 
12 rows selected.and use the advise of William Robertson:
http://www.williamrobertson.pwp.blueyonder.co.uk/documents/one_row.html
SQL> select team_id, substr(epath,2) "ids",
2 rtrim(substr(npath,2),',') "members"
3 from (
4 select team_id, max(sys_connect_by_path(emp_id,',')) epath,
5 max(sys_connect_by_path(name,',')) npath from (
6 select team_id, a.emp_id, name, row_number()
7 over(partition by team_id order by name nulls last) rn
8 from t_emp_team_n a, t_emp_names b
9 where a.emp_id = b.emp_id (+)
10 )
11 start with rn = 1 connect by prior team_id = team_id
12 and prior rn = rn -1
13 group by team_id
14 )
15 /
 
TEAM_ID ids members
1 4,3,11 Liz,Mark
2 3,8,6 Mark
3 5,10,9 Will
4 2,7,9 PeterRgds. -
Two invoice types order-related from the same sales order type
Hi experts,
I need to assign a different invoice type to two different items categories regarding to invoice each item with a different invoice rumber range and a different accounting document type (one 'RV' and another 'PF').
Neither of them have delivery.
I' ve assigned in the copy controls from sales orders to invoices the items categories to the corresponding invoice type in order to avoid the items are invoiced by wrong invoice type.
Exem:
item category ZIC1 must be invoiced by invoice type ZF1
item category ZIC2 must be invoiced by invoice type ZF2
I executed VF04 twice: first regarging to create ZF1 and second create ZF2.
1) If I insert ZF1 invoice type (order-related) by default in the sales orders definition (Sales and Distribution -> Sales -> Sales -> Sales Document Header -> Define Sales Document Types), the item ZIC1 is properly invoiced and the ZIC2 too. But: although I already invoiced both items, SAP laves the sales order opened waiting to create ZF1 for ZIC2.
2) If I don't fill the invoice type by defautl, the invoicing can't be done because the invoice type isn't determined (VKDFS-FKART empty).
I want to know if there is any exit to change the values of VKDFS entries for each item of sales orders before to process this table with VKDFS.
Thanks in advance,
AupalauraHi,
thanks a lot for the quick answer.
But in save document prepare it's not this structure. And the field for save the invoice type by default is at header level FKARA (in VBAK table).
Anyway, I'll check it.
Regards,
Aupalaura -
Hi, I have a table (DFO_TRACE) that has two columns CURRENT_FID and SOURCE_FID and I want to find out what are the values that are present in the CURRENT_FID that are not present in the SOURCE_FID for example:
SOURCE_FID | CURRENT_FID
1 | 2
2 | 3
2 | 4
4 | 5
So in the example above I would like to do a select that would return CURRENT_FID = 3 and 5.
I've tried to write the following code to do this, but when I execute it, it doesn't return anything to me:
select A.CURRENT_FID from DFO_TRACE A
left outer join DFO_TRACE B
on A.CURRENT_FID = B.SOURCE_FID
where A.ID_GRUPO_TRACE = 177 and B.ID_GRUPO_TRACE = 177 and B.SOURCE_FID is null;Can anyone help me?
PS: I am using Oracle 10g.
Thanks,
KomygThe reason you posted query does not work is that the predicate B.ID_GRUPO_TRACE = 177 in the where clause removes all od the "made_up" records from the b version of the table since their id_grupo_trace would be null. You would need to modify your query to something more like:
SELECT a.current_fid
FROM dfo_trace a
LEFT JOIN dfo_trace b
ON a.current_fid = b.source_fid and
a.id_grupo_trace = b.id_grupo_trace
WHERE a.id_grupo_trace = 177 and
b.source_fid IS NULL;John -
Type 1 and Type 2 dimension in the same table
Assuming a table with both Type 1 and Type 2 dimensions how do you engineer an ETL load?
Please correct my options below if I am wrong
Option 1: Inside a Slowly changing dimension set all 3, fixed attributes, Historical attributes and changing attributes. Since historical attributes is Type 2 and changing attributes is Type 1. We get what we want, Correct?
Option 2: writing a merge statement, but not sure how exactly i would be code that.
Please suggest a way if you think both the options are wrong. Thanks in advance.
svkHi, Please refer to the
msdn blog.
Hope this helps..............
Ione -
Calculating average time from two records from the same table.
Hi all
I need to calculate the average time between two events that are recorded in the same table.
The table is TMS_MESSAGE_AUDIT_LOG
MESSAGE_ID VARCHAR2(16 BYTE) NOT NULL,
MESSAGE_VERSION NUMBER(2) NOT NULL,
CREATE_TM VARCHAR2(18 BYTE) NOT NULL,
MESSAGE_STATUS VARCHAR2(30 BYTE),
TRANSACTION_TYPE_NM VARCHAR2(30 BYTE),
MESSAGE_TP VARCHAR2(3 BYTE),
WORKFLOW_OBJECT VARCHAR2(30 BYTE) NOT NULL,
WORKFLOW_REQUEST VARCHAR2(30 BYTE) NOT NULL,
WORKFLOW_RETURN_CD VARCHAR2(30 BYTE) NOT NULL,
AUDIT_ACTION VARCHAR2(255 BYTE),
LAST_UPDATE_USER_LOGON_ID VARCHAR2(12 BYTE),
LOCAL_TM VARCHAR2(18 BYTE) NOT NULL,
LOCAL_TIME_ZN_NM VARCHAR2(70 BYTE) NOT NULL,
LOCAL_DAYLIGHT_IN CHAR(1 BYTE) NOT NULL,
FPRINT VARCHAR2(30 BYTE)
What i now need is
When the MESSAGE_ID is the same i need have the average time between when the MESSAGE_STATUS is AA and BB ( I need the time out of the CREATE_TM field )
And this for every 15 minutes interval.
Because this table will become BIG millions and millions of records it needs to be fast.
Can anybody help me.
MarcelSomething like this?
CREATE TABLE wr_test
( message_id VARCHAR2(16 BYTE) NOT NULL
, message_version NUMBER(2) NOT NULL -- Assumption: Acknowledged ver > Received ver
, create_tm VARCHAR2(18 BYTE) NOT NULL
, message_status VARCHAR2(30 BYTE)
, transaction_type_nm VARCHAR2(30 BYTE)
, workflow_object VARCHAR2(30 BYTE) DEFAULT 'x' NOT NULL
, workflow_request VARCHAR2(30 BYTE) DEFAULT 'x' NOT NULL
, workflow_return_cd VARCHAR2(30 BYTE) DEFAULT 'x' NOT NULL
, audit_action VARCHAR2(255 BYTE)
, last_update_user_logon_id VARCHAR2(12 BYTE)
, local_tm VARCHAR2(18 BYTE) NOT NULL
, local_time_zn_nm VARCHAR2(70 BYTE) DEFAULT 'GMT' NOT NULL
, local_daylight_in CHAR(1 BYTE) DEFAULT 'x' NOT NULL );
INSERT ALL
INTO wr_test
( message_id
, message_version
, create_tm
, message_status
, local_tm )
VALUES ( message_id
, 1
, create_tm
, '(Receive)'
, TO_CHAR(local_tm,'YYYYMMDD HH24:MI:SS') )
INTO wr_test
( message_id
, message_version
, create_tm
, message_status
, local_tm )
VALUES ( message_id
, 2
, create_tm
, 'Wait CLSB Ack'
, TO_CHAR
( local_tm + NUMTODSINTERVAL(DBMS_RANDOM.VALUE(0,2e5),'SECOND')
, 'YYYYMMDD HH24:MI:SS' ) )
SELECT ROWNUM AS message_id
, TO_CHAR(SYSDATE,'YYYYMMDD HH24:MI:SS') AS create_tm
, DATE '2000-01-01' + DBMS_RANDOM.VALUE(0,3) AS local_tm
FROM dual CONNECT BY ROWNUM < 100000;
WITH src AS
( SELECT message_id
, message_status
, message_version
, TO_DATE(SUBSTR(local_tm,1,17),'YYYYMMDD HH24:MI:SS') AS dt
, TO_DATE(SUBSTR(local_tm,1,8),'YYYYMMDD') AS dt_day
, TO_CHAR(TO_DATE(SUBSTR(local_tm,10,8),'HH24:MI:SS'),'SSSSS') AS dt_sec
FROM wr_test
WHERE message_status IN ('(Receive)','Wait CLSB Ack') )
SELECT dt_day + NUMTODSINTERVAL(period,'SECOND') AS dt
, NUMTODSINTERVAL(AVG(elapsed),'DAY') AS avg_elapsed
, NUMTODSINTERVAL(MIN(elapsed),'DAY') AS min_elapsed
, NUMTODSINTERVAL(MAX(elapsed),'DAY') AS max_elapsed
, COUNT(*)
FROM ( SELECT message_id
, message_status
, dt_day
, TRUNC(dt_sec/300)*300 AS period
, LEAD(dt) OVER (PARTITION BY message_id ORDER BY message_version) AS ack_dt
, LEAD(dt) OVER (PARTITION BY message_id ORDER BY message_version) - dt AS elapsed
FROM src ) cal
WHERE cal.message_status = '(Receive)'
GROUP BY dt_day, period
ORDER BY 1;Replace "wr_test" with "tms_message_audit_log" in the WITH subquery to test on your data. -
Two LOVs in same UIX page based on the same table
Hi group,
Recently I ran into a problem with a UIX page that has two LOVs based on the same database table. In Emp and Job terminology, here's what I tried to do.
Suppose we have use the Employees and Jobs tables from the HR scheme with one small modification. Add a column called PREFERRED_JOB_ID of type VARCHAR2(10) which is exactly the same as JOB_ID. Hypothetically speaking, this column will be used to allow Employees to select their preferred job in case they want to change their jobs.
Next, create business components in JDeveloper based on the Employees and Jobs table. In order to be able to generate the LOVs for Job and PreferredJob create two ViewObjects, one called JobsLookupView and one called PreferredJobsLookupView. These both need to be based upon the same Jobs EntityObject. Also include the Jobs EntityObject twice in the EmployeesView ViewObject and give one the alias PreferredJobs. Include the JobTitle attributes of Jobs and PreferredJobs in EmployeesView so they can contain the JobTitles selected in our future LOVs.
Next create a ViewController project if it's not already there and enable JHeadstart on it. Create an Application Structure File and create the lookups for the two LOVs. When I run the application I see this happening:
When I click the flashlight icon next to the PreferredJob LOV and select a job, the PreferredJob field is selected in the UIX page but no job title appears. When I next first select the Job LOV and select a new job and then select the PreferredJob LOV again and select a different job, the job that was selected in the Job LOV is now also entered in the PreferredJob field. When I make sure the PreferredJob field isn't required (remove the required="yes" property on the messageLovInput entry for PreferredJobTitle and remove the PreferredJobTitle field from the addRequiredRowItems list in the UIX page) I can save the changes I made in the Employees.uix page. The same JobId is stored in the database for Job and PreferredJob.
This behaviour is probably due to cacheing issues because both LOVs and the EmployeesView ViewObject use one EntityObject for four values in three ViewObjects.
So I then modified my model a bit. I created a new EntityObject called PreferredJobs based on the JOBS table. I modified the EmployeesView ViewObject to use this EntityObject for the PreferredJobTitle attribute and modified the PreferredJobsLookupView to use this EntityObject.
I needed to modify a few things as well in the Application Structure File (which were prompts and whether or not the attribute should be visible in a table) and after regenerating I made sure the PreferredJob attribute isn't required in the UIX page. When I then run the application again, I never see the JobTitle I select in any LOV allthough the PreferredJob field is selected when I select a Job in the PreferredJob LOV. The correct JobId now is stored in the database though.
Has anyone ever encoutered this behaviour? Would anyone know how to get two LOVs based on the same table in one UIX page?
Thanks in advance,
Wouter van Reeven
AMISOK I figured it out. When I added the second Lookup ViewObject (PreferredJobs) no additional Association was created. Therefore, ADF BC wasn't able to figure out which field to update. When I added the Association between the PreferredJobs Lookup ViewObject and the Employees ViewObject everything started working ok.
I then recreated my inital situation: one EntityObject for Jobs and one for Employees, now with two Associations between them. After modifying the Employees ViewObject and making sure the Jobs EntityObject was referred twice and via the corresponding Association, everything started working ok.
Greets, Wouter
AMIS -
Compare two results from the same table
i have two results from the same table that i would like to compare. below is my query and the results i want to compare
SELECT tblItemRoutingBOM.ItemRevID, tblItem.ItemID, tblItem.PartNum, tblItem.ItemName, tblItem.ManufacturerPartNum AS [Mfg Part#], tblItemRoutingBOM.Quantity
FROM tblItemRouting
INNER JOIN tblItemRoutingBOM ON tblItemRouting.ItemRoutingID = tblItemRoutingBOM.ItemRoutingID
INNER JOIN tblItem ON tblItemRoutingBOM.ItemID = tblItem.ItemID
WHERE tblItemRoutingBOM.ItemRevID in (61,70)
as you can see i am returning two records using the where clause
ItemRevID, ItemID, PartNum, ItemName, Manufacturer, Mfg Part#, Quantity
61,121,331503,.233 Aluminum Sheet,,1
70,121,331503,.233 Aluminum Sheet,,3
now what i am looking for is to combine these two together into one row with the following added. two columns for each QTY, QTY1 = 1 and QTY2 = 3 with a third column added that is the difference between the two QTY Diff = 2
Any thoughts?Here are the two statements that i want to combine, results for each are attached
SELECT tblItem.ItemID, Sum(tblItemRoutingBOM.Quantity) AS SumOfQuantity, tblItem.PartNum AS [Part #],
tblItem.ItemName, tblManufacturer.ManufacturerName AS Manufacturer, tblItem.ManufacturerPartNum AS [Mfg Part#]
FROM tblItemRouting
INNER JOIN tblItemRoutingBOM ON tblItemRouting.ItemRoutingID = tblItemRoutingBOM.ItemRoutingID
INNER JOIN tblItem ON tblItemRoutingBOM.ItemID = tblItem.ItemID
INNER JOIN tblUnits ON tblItem.UnitID = tblUnits.UnitID
LEFT JOIN tblManufacturer ON tblItem.ManufacturerID = tblManufacturer.ManufacturerID
WHERE tblItemRoutingBOM.ItemRevID=61
GROUP BY tblItem.ItemID,tblItem.PartNum,tblItem.ItemName,tblManufacturer.ManufacturerName,tblItem.ManufacturerPartNum
SELECT tblItem.ItemID, Sum(tblItemRoutingBOM.Quantity) AS Quantity, tblItem.PartNum AS [Part #],
tblItem.ItemName, tblManufacturer.ManufacturerName AS Manufacturer, tblItem.ManufacturerPartNum AS [Mfg Part#]
FROM tblItemRouting
INNER JOIN tblItemRoutingBOM ON tblItemRouting.ItemRoutingID = tblItemRoutingBOM.ItemRoutingID
INNER JOIN tblItem ON tblItemRoutingBOM.ItemID = tblItem.ItemID
INNER JOIN tblUnits ON tblItem.UnitID = tblUnits.UnitID
LEFT JOIN tblManufacturer ON tblItem.ManufacturerID = tblManufacturer.ManufacturerID
WHERE tblItemRoutingBOM.ItemRevID=70
GROUP BY tblItem.ItemID,tblItem.PartNum,tblItem.ItemName,tblManufacturer.ManufacturerName,tblItem.ManufacturerPartNum
114,11,55002,Pepsi Blue Cap,NULL,
117,5,331501,Marigold Yellow For ABS,NULL,
121,1,331503,.233 Aluminum Sheet,NULL,
125,2,331504,Velvet Vinyl .008,NULL,
114,33,55002,Pepsi Blue Cap,NULL,
117,15,331501,Marigold Yellow For ABS,NULL,
121,3,331503,.233 Aluminum Sheet,NULL,
125,6,331504,Velvet Vinyl .008,NULL,
my returned result should combine above with two extra columns (two extra columns because i have two results to combine)
114, 11, 33, 22, 55002, Pepsi Blue Cap, NULL,
117, 5, 15, 10, 331501, Marigold Yellow For ABS, NULL
121,1, 3, 2, 331503, .233 Aluminum Sheet, NULL
125, 2, 6, 4, 331504, Velvet Vinyl .008, NULL
Columns go as such, ID, QTY1 (for 61), QTY2 (for 70), Diff (QTY1-QTY2), PartNum, ItemName, Mfg, Mfg Part#
IF the results from one of those two are empty then i would see something like this
114, 11, 0, 11, 55002, Pepsi Blue Cap, NULL,
117, 5, 0, 5, 331501, Marigold Yellow For ABS, NULL
121,1, 0, 1, 331503, .233 Aluminum Sheet, NULL
125, 2, 0, 2, 331504, Velvet Vinyl .008, NULL -
[nQSError: 14065] Illegal cross join within the same dimension
Hey guys,
I'm stumped. I have two dimension tables that are joined 1:N (there is NOT an M:N relationship between them) and I have them joined in the Physical Layer and the Business Model and Mapping Layer. The two tables are F4101 (the "1") and F4102 (the "N") in the 1:N relationship. F4102 then joins to a fact table, and F4101 joins to NOTHING else. So I don't believe I have a circular condition or a need for a bridge table. Both tables are published to the Presentation Layer for reporting.
The error occurs in Answers when I want to do something as trivial as display the three primary key columns together from F4101: F4101.col1, F4101.col2, F4101.col3 (all three make up the PK). When I do that, the following error occurs:
"nQSError: 14065] Illegal cross join within the same dimension caused by incorrect subject area setup: [ F4101 T28761] with [ F4102 T1805] "
What I can't figure out is WHY the F4102 table is listed in this error. I didn't try to report on it at all. See the logical SQL below from my query:
"SQL Issued: SELECT "Item Master (F4101)".IMITM saw_0, "Item Master (F4101)".IMLITM saw_1, "Item Master (F4101)".IMAITM saw_2 FROM "Sales Analysis" ORDER BY saw_0, saw_1, saw_2"
As soon as I take out one of the three PK columns and add in another non-PK column from F4101, it works just fine. And reporting on each of the three PK columns individually works as well in Answers.
Any ideas? I would greatly appreciate it.
Thanks.Try this;
1. In the logical layer, create one folder called F4101_F4102.
2. Map both F4101 and F4102 as logical table sources in that folder.
3. Join from the folder F4101_F4102 to the fact using a Logical (new complex join) join.
Chris. -
Illegal cross join within the same dimension
Hi,
When certain fields are selected within the presentation table an "illegal cross join" error is returned by the BI Server. However if a FACT is added from one of the other presentation tables the "illegal cross join" error goes away. we need to query without fact column.
We are getting following error
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 14065] Illegal cross join within the same dimension caused by incorrect subject area setup: [ CALL_CENTER.COUNSELOR_MANAGER T782130] with [ CALL_CENTER.COUNSELOR_HR T781594 On CALL_CENTER.COUNSELOR_HR.MASTER_STAFF_COUNSELOR_ID = CALL_CENTER.MASTER_STAFF_COUNSELOR.MASTER_STAFF_COUNSELOR_ID, CALL_CENTER.MASTER_STAFF_COUNSELOR T781739] (HY000)
Can anybody help me solving this issue.
Thanks,
KS.Please give us an example of what you need.
OBIEE perform a query in the dimension or through the fact table.
You can't join two dimensions in the repository without going through a fact table.
If you need to query without fact column, it's because you have design two dimensions where
normally you can do one.
You have then two solutions :
* change the design of your logical model to make only one dimension.
* use the OBIEE logical SQL in answer.
http://gerardnico.com/wiki/dat/obiee/bi_server/design/obiee_logical_sql
Success
Nico -
Illegal cross join within the same dimension caused by incorrect
Hi,
I created a logical table from 2 different Physical tables. Then I created a Dimension out of this logical table.
At the BI Answer, while I tried drilling on the dimension, I get the following error:
“Illegal cross join within the same dimension caused by incorrect subject area setup “
Please let me know if there is any work around this issue.
Thanks,I think that OBIEE try to do a cross join but don't allow it
http://gerardnico.com/wiki/dw/join/cross_join
It generate surely a join with two tables where you don't have any condition or relation in the physical layer.
When you check the column from the subject area are you sure that you have a condition in the physical layer for the two tables ?
When you say "I tried drilling on the dimension", does it means that you have a report and when you click on link which come from a dimension level, it doesn't work ?
Regards
Nico -
If you registrate one Apple ID for each iPhone/iPad, you'll get 5GB on iCloud for each Apple ID, right? I have two iPhones and one iPad with the same Apple ID, why can't I get 5 GB fo each of them?
Actually, everyone missed one point, when a device is priced, the cost of icloud storage space for that device is also included in it that is why they are able to give you 5gb each for each user ID, in nutshell there is nothing free coming with apple device purchase, it is paid for. What they are trying by giving only 5gb per user ID irrespective of the number of devices used is pure broadlight looting, they take money from you when you buy each device and give you nothing, This is a case of goods and services bought but not fully deliverd ie apple can be suied for discreminatory treatment towards it's users. I wonder why no one tried this yet in America where everyone sue everyone for petty things..... there is no one to take up this issue? . if tim got any love for the guys who shell out money for the devices his company makes, he should be implimenting this as priority before someone wake up from sleep and sue him.
Maybe you are looking for
-
I am trying to download itunes to windows 7 and keep getting the error message "cannot access network location $APPDATA%\." I have contacted an Apple advisor and was not able to resolve the problem. What to do?
-
Edit in photoshop! My images aren't coming back to LR.
I am using LR 5.7 and CS6. When I use the "edit in photoshop" feature I am getting stuck because my images are not coming back to LR. They are being sent, as TIF's, to original folder where all the RAW files are. I have to go search for it and reimpo
-
Hello!I am a chinese Java2 learner.I want to ask you a question : Why do the instance variables of Jpanel class can not be declared as a array,just like JButton class? For example : JPanel[] pane = new JPanel[4]; pane[0].add( ...); pane[1].add( ...);
-
Brightness unadjustable for "High Performance" in Switchable Graphics Card Technology
Hello, I have just transitioned to Windows 7 Professional on my Thinkpad R400(2787-A31) However, after installing the Thinkpad Switchable Graphics Card driver, i am unable to adjust my brightness if i am using the High Performance mode. My laptop com
-
I have a WRT54G v8 router with a windows7 computer. Every couple of days, my internet connection will crash. Sometimes multiple times in a day consisitantly. If I unplug and plug the router back in, I'll have a connection. But after a while it will c