scope of the subquery table problem
I am trying to run after update query:UPDATE of STG DAST
SET TRAVEL_COUNTRY = (SELECT TRAVEL_COUNTRY_FULL
FROM (SELECT TRAVEL_COUNTRY_FULL,
RANK() AT GRADE (A.PERSON_ID ORDER BY A.LAST_UPDATE_DATE DESC, A.LOC_START_DATE DESC, ASC A.LOC_END_DATE PARTITION)
FROM APPS. TCS_MIS_EIT_LOCATION_EX HAS
WHERE A.PERSON_ID = DAST. PERSON_ID
AND A.TRAVEL_TYPE = S"
AND 1 November 2011 ' BETWEEN A.EFFECTIVE_START_DATE AND A.EFFECTIVE_END_DATE
AND 1 November 2011 ' BETWEEN A.LOC_START_DATE AND A.LOC_END_DATE)
WHERE = 1);
This is in error as ' * DAST.» "PERSON_ID *: invalid identifier.
But PERSON_ID column of table STG. AFAIK in the outer subquery table will be visible in the internal subquery in such a way that it is. But here it seems that issues. Kindly help me to solve this problem.
UPDATE STG DAST
SET TRAVEL_COUNTRY = (
SELECT MAX(TRAVEL_COUNTRY_FULL) KEEP(DENSE_RANK FIRST ORDER BY A.LAST_UPDATE_DATE DESC,A.LOC_START_DATE DESC,A.LOC_END_DATE ASC)
FROM APPS.TCS_MIS_EIT_LOCATION_EX A
WHERE A.PERSON_ID = DAST.PERSON_ID
AND A.TRAVEL_TYPE = 'S'
AND DATE '2011-11-01' BETWEEN A.EFFECTIVE_START_DATE AND A.EFFECTIVE_END_DATE
AND DATE '2011-11-01' BETWEEN A.LOC_START_DATE AND A.LOC_END_DATE
);
SY.
Tags: Database
Similar Questions
-
I was looking for the solution and find many examples, but I do not know what is the best in my option and don't understand everything.
I realized that can't do a SELECT query in the table where trigger is triggered. But I have need SELECT COUNT (col), then MAX (id) of this table, update some statistical info...
And also need to row id update, so I can't do trigger of table instead of relaxation of the line.So this is my TRIGGER:
create or replace
update_stat relaxation
AFTER UPDATE ON TABLE1 TO EACH LINE
DECLARE
juice FLOAT;
all the NUMBER;
end NUMBER;
BEGIN
IF (: old.ended <>: new.ended) THEN
SELECT COUNT (id) FROM end FROM table1 WHERE fk_table2 = new.fk_table2 AND finished = 1; -Error in the table of mutation
SELECT COUNT (id) FROM everything FROM table1 WHERE fk_table2 = new.fk_table2; -Error in the table of mutation
Juice: = ((end /all) * 100);
UPDATE table2 SET suc = success WHERE id =:new.fk_table2;
END IF;
END;
I also tried with
pragma autonomous_transaction;
trigger body....AND
commit;
But don't working right when insert more records.
Thanks, Urban
Data and structure of the example table
SQL> create table table2 2 ( 3 id integer 4 , success number 5 , constraint table2_pk primary key (id) 6 ); Table created. SQL> create table table1 2 ( 3 id integer 4 , id_t2 integer 5 , ended integer 6 , constraint table1_pk primary key (id) 7 , constraint table1_fk_id_t2 foreign key (id_t2) references table2 8 ); Table created. SQL> insert into table2(id, success) values (1, 0); 1 row created. SQL> insert into table2(id, success) values (2, 0); 1 row created. SQL> insert into table1 2 ( 3 id 4 , id_t2 5 , ended 6 ) 7 select level 8 , ceil(level/10) 9 , 0 10 from dual 11 connect by level <= 20; 20 rows created. SQL> commit; Commit complete.
Create objects to the suite
create or replace type update_stat_obj as object (id integer, id_t2 integer, ended integer) / create or replace type update_stat_tbl as table of update_stat_obj / create or replace package update_stat_pkg as g_table_1 update_stat_tbl; procedure load(p_id integer, p_id_t2 integer, p_ended integer); procedure updt; end; / show err create or replace package body update_stat_pkg as procedure load(p_id integer, p_id_t2 integer, p_ended integer) is begin if g_table_1 is null then g_table_1 := update_stat_tbl(); end if; g_table_1.extend; g_table_1(g_table_1.count) := update_stat_obj(p_id, p_id_t2, p_ended); end; procedure updt is begin merge into table2 t2 using ( select t1.id_t2 , (count(t2.id)/count(t1.id))*100 success from table1 t1 left join table(g_table_1) t2 on t1.id = t2.id and t2.ended = 1 group by t1.id_t2 ) t1 on (t2.id = t1.id_t2) when matched then update set t2.success = t1.success; g_table_1 := null; end; end; / show err create or replace trigger update_stat_row_trig after update on table1 for each row begin if (:old.ended <> :new.ended) then update_stat_pkg.load(:new.id, :new.id_t2, :new.ended); end if; end; / show err create or replace trigger update_stat_trig after update on table1 begin update_stat_pkg.updt; end; / show err
Now look for the UPDATE.
SQL> select * from table1; ID ID_T2 ENDED ---------- ---------- ---------- 1 1 0 2 1 0 3 1 0 4 1 0 5 1 0 6 1 0 7 1 0 8 1 0 9 1 0 10 1 0 11 2 0 12 2 0 13 2 0 14 2 0 15 2 0 16 2 0 17 2 0 18 2 0 19 2 0 20 2 0 20 rows selected. SQL> select * from table2; ID SUCCESS ---------- ---------- 1 0 2 0 SQL> update table1 set ended = 1 where id between 1 and 7 or id between 11 and 19; 16 rows updated. SQL> select * from table2; ID SUCCESS ---------- ---------- 1 70 2 90 SQL> select * from table1; ID ID_T2 ENDED ---------- ---------- ---------- 1 1 1 2 1 1 3 1 1 4 1 1 5 1 1 6 1 1 7 1 1 8 1 0 9 1 0 10 1 0 11 2 1 12 2 1 13 2 1 14 2 1 15 2 1 16 2 1 17 2 1 18 2 1 19 2 1 20 2 0 20 rows selected.
-
Selection of records in the same table problem
Hi all
I have the following table
My results should bewith emp as ( select '11' A,'aaa' B, '40' C from dual union all select '11','bbb', '40' from dual union all select '33','ccc', '30' from dual union all select '44','ddd', '20' from dual union all select '11','eee', '10' from dual )
Basically the requirement is select different combination of values in the column 'B' need to know what is the value of 'A' (it must be the same for all records of three)A B C 11 aaa 40 11 bbb 40 11 eee 10
Hope in this sense.
See you soon
Sexyan attempt to rephrase:
you want all the files "aaa", "bbb" and "EEA" where, for each set of column A, where they exist.
that is, if games to have only "aaa" and "bbb" but not "eee" in column B, then you don't want to retrieve this record?
Try this:
SQL> with emp as ( 2 select '11' A,'aaa' B, '40' C from dual union all 3 select '11','bbb', '40' from dual union all 4 select '33','ccc', '30' from dual union all 5 select '44','ddd', '20' from dual union all 6 select '11','kkk', '20' from dual union all 7 select '10','eee', '20' from dual union all 8 select '11','eee', '10' from dual 9 ) 10 select a, b, c 11 from (select emp.*, count(*) over (partition by a) cnt 12 from emp 13 where b in ('aaa','bbb','eee')) 14 where cnt = 3 15 / A B C -------------------------------- -------------------------------- -------------------------------- 11 eee 10 11 aaa 40 11 bbb 40 3 rows selected.
Published by: WhiteHat June 30, 2011 11:04
-
Update for the tree table problem
Hello
I use jdev tudio Edition Version 11.1.1.4.0
I used the table tree to display my hirarchical data. I'm Bulding object for the purpose of list of floor.
I created pojo data control. I am trying to drag and drop the level 1 of bulding1 on the bulding2 so it will be added to the bulding2. for that I packed a pojo addfloor() method and I add object floor in to list of floor of the bulding2 object. but the picture of the tree will not show the list update for bulding2.
My question is how update the table of the tree so that it displays the data added to pojo on UI?
I created the data from pojo under control
package model;
import java.util.ArrayList;
import java.util.List;
public class {Enterprise
private list < Bulding > lstbuldingFor = new ArrayList < Bulding > ();
Public Enterprise() {}
Super();
Bulding objbulding = new Bulding();
objbulding.setBuldingName ("Bulding1");
List < floor > lstfloor = new ArrayList < floor > ();
Floor objfloor is new Floor();.
objfloor.setFloorname ("Floor1");
lstfloor. Add (objfloor);
Floor objfloor2 is new Floor();.
objfloor2.setFloorname ("Floor2");
lstfloor. Add (objfloor2);
objbulding.setLstfloor (lstfloor);
lstbuldingFor.add (objbulding);
Bulding objbulding2 = new Bulding();
objbulding2.setBuldingName ("Bulding2");
List < floor > lstfloor2 = new ArrayList < floor > ();
Floor objfloor3 is new Floor();.
objfloor3.setFloorname ("Floor3");
lstfloor2. Add (objfloor3);
Floor objfloor4 is new Floor();.
objfloor4.setFloorname ("Floor4");
lstfloor2. Add (objfloor4);
objbulding2.setLstfloor (lstfloor2);
lstbuldingFor.add (objbulding2);
}
{public adddFloor Sub (floor objfloor, String buldingName)
System.out.println ("buldingName" + buldingName);
System.out.println ("floor" + objfloor.getFloorname ());
for (Bulding objBld:lstbuldingFor) {}
{if (objBld.getBuldingName (.equalsIgnoreCase (buldingName)))}
List < floor > objtempflr = new ArrayList < floor > ();
System.out.println ("had correspondence");
objtempflr = objBld.getLstfloor ();
objtempflr. Add (objfloor);
objBld.setLstfloor (objtempflr);
break;
}
}
getLstbuldingFor();
}
{} public void setLstbuldingFor (list < Bulding > lstbuldingFor)
this.lstbuldingFor = lstbuldingFor;
}
public list < Bulding > getLstbuldingFor() {}
for (Bulding objbld:lstbuldingFor) {}
System.out.println ("@" + objbld.getBuldingName ());
for (floor objflr:objbld.getLstfloor()) {}
System.out.println ("@" + objflr.getFloorname ());
}
}
Return lstbuldingFor;
}
}
I'll call adddFloor() of the user interface to add the word to the bulding.Hello
Make sure that you re - run the iterator that fills the tree. You make a change in the control of data, which is not immediately reflected in the link layer
Frank
-
What to fill in 'field of the temporary table' for global temporary tables?
Hello
I use the Data Modeler 4.0.1.836 and everything that I put in the box 'the scope of the table temp' for a global temporary table doesn't seem to affect the DDL script about the ON COMMIT PRESERVE/DELETE the LINES option. The script poster ON COMMIT PRESERVE ROWS always anything.
Yet, some of my temporary tables must be created as ON COMMIT DELETE ROWS.
Using the Data Modeler wrote about it:
Scope of the temporary Table:
For a class as a temporary table, you can specify a scope, such as the Dimension or the Session.
Not sure what 'Dimension' has to do with the scope here, but it makes no difference.
I tried to put 'Session', 'Dimension', 'Operation', but no luck. So what is the text for the script generate ON COMMIT DELETE ROWS?
Thank you
Hello
The temporary Scope of Table property (on page Types of Classification of the table properties dialog box) is purely documentary.
To set ON COMMIT DELETE ROWS you must expand the browser for the relational model and find the node for the relevant Oracle physical model. If you develop it you will find an entry there for your Table. Double-click on that to get the physical model properties dialog box for your table, and you will find a "Temporary" facility that has options (Preserve Rows), YES (Delete Rows) YES or no.
David
-
Changing aid necessary table problem
Hello. I hope someone can help me with this problem.
I have two tables, an and mv. Create the following script:
create table (mv)
the moduleId Char (2) CONSTRAINT ck_moduleId CHECK (moduleId in ("M1", "M2", "M3", "M4', 'M5', 'M6', 'M7', 'M8'")).
credit ck_credits Number (2) CONSTRAINT CHECK (credits (10, 20, 40));
constraint pk_mv primary key (moduleId)
);
create table (its)
stuId Char (2) CONSTRAINT ck_stuId CHECK (stuId ('S1', 'S2', 'S3', 'S4', 'S5')),
moduleId tank (2),
primary key constraint (stuId, moduleId) pk_sa,
constraint fk_moduleid foreign key (moduleId) references (moduleId) mv
);
And the scripts below is to insert data into the two:
insert into VALUES mv ("M1", 20)
/
insert into VALUES mv ("M2", 20)
/
insert into VALUES mv ("M3", 20)
/
insert into VALUES mv ("M4", 20)
/
Insert in mv VALUES ('M5', 40)
/
insert into VALUES mv ("M6", 10)
/
insert into VALUES mv ("M7", 10)
/
Insert in mv VALUES ('M8', 20)
/
insert into a VALUES ('S1', 'M1')
/
insert into a VALUES ('S1', 'M2')
/
insert into a VALUES ('S1', 'M3')
/
insert into a VALUES ('S2', 'M2')
/
insert into a VALUES ('S2', 'M4')
/
insert into a VALUES ('S2', 'M5')
/
insert into a VALUES ('S3', 'M1')
/
insert into a VALUES ('S3', 'M6')
/
Now for the real problems.
First of all, I need to try to overcome the problem of table mutation ensure that stuid = S1 in table its can not take the two moduleId M5 and M6.
Just one or the other. I created a single trigger, but runs aground because of the changing table problem.
The second problem that I need to overcome is that none of the stuids can have the ModuleID where total value of more than 120 credit credits. Credit value is stored in the table of mv.
Thank you very much in advance for any help.Use a statement-level trigger:
First of all, I need to try to overcome the problem of table mutation ensure that stuid = S1 in table its can not take the two moduleId M5 and M6.
SQL> create or replace trigger sa_trg 2 after insert or update on sa 3 declare 4 c number; 5 begin 6 select count(distinct moduleId) into c 7 from sa 8 where stuid = 'S1' 9 and moduleId in ('M5','M6'); 10 if c > 1 then 11 raise_application_error(-20001,'S1 on both M5 and M6!!'); 12 end if; 13 end; 14 / Trigger created. SQL> select * from sa; ST MO -- -- S1 M1 S1 M2 S1 M3 S2 M2 S2 M4 S2 M5 S3 M1 S3 M6 8 rows selected. SQL> insert into sa values ('S1','M5'); 1 row created. SQL> insert into sa values ('S1','M6'); insert into sa values ('S1','M6') * ERROR at line 1: ORA-20001: S1 on both M5 and M6!! ORA-06512: at "SCOTT.SA_TRG", line 9 ORA-04088: error during execution of trigger 'SCOTT.SA_TRG'
The second problem that I need to overcome is that none of the stuids can have the ModuleID where total value of more than 120 credit credits. Credit value is stored in the table of mv
SQL> create or replace trigger sa_trg 2 after insert or update on sa 3 declare 4 c number; 5 begin 6 select count(distinct moduleId) into c 7 from sa 8 where stuid = 'S1' 9 and moduleId in ('M5','M6'); 10 if c > 1 then 11 raise_application_error(-20001,'S1 on both M5 and M6!!'); 12 end if; 13 14 select count(*) into c from ( 15 select stuid 16 from mv, sa 17 where sa.moduleid=mv.moduleid 18 group by stuid 19 having sum(credits)>120); 20 21 if c > 0 then 22 raise_application_error(-20002,'A student cannot have more than 120 credits!!'); 23 end if; 24 25 end; 26 / Trigger created. SQL> select stuid, sum(credits) 2 from mv, sa 3 where sa.moduleid=mv.moduleid 4 group by stuid; ST SUM(CREDITS) -- ------------ S3 30 S2 80 S1 100 SQL> insert into sa 2 values ('S1','M4'); 1 row created. SQL> select stuid, sum(credits) 2 from mv, sa 3 where sa.moduleid=mv.moduleid 4 group by stuid; ST SUM(CREDITS) -- ------------ S3 30 S2 80 S1 120 SQL> insert into sa 2 values ('S1','M7'); insert into sa * ERROR at line 1: ORA-20002: A student cannot have more than 120 credits!! ORA-06512: at "SCOTT.SA_TRG", line 20 ORA-04088: error during execution of trigger 'SCOTT.SA_TRG'
Max
http://oracleitalia.WordPress.com -
Problem with update of table (using the subquery to retrieve value)
Hello
I update a table based on the value of the subquery.
Here's the update statement.
UPDATING temp xm
SET xm.col1 = (SELECT DISTINCT col1
Of
(SELECT col1, col2 COUNT (col2)
FROM table2
WHERE col1 = xm.col1
AND col2 = xm.col2
GROUP BY col1)
where col2 in (select... in the table3)
)
WHERE xm.col5 = < value >
AND xm.col6 = < value >
When I run this statement I get following error.
ORA-00904: "XM". "" Col1 ": invalid identifier.
Can someone help me why I get this error?
Why doesn't the main table alias in the subquery?
Is it possible to avoid this / re - write the query in a different way?
Thank you
Published by: user552703 on November 2, 2009 20:42You can nest only 1 level deep (referring to the table to be updated).
Have you looked at using the MERGE command? It is "easier" perform updates of this nature, assuming you are using a recent version of Oracle (9 or MORE).
-
Scope of violation in the subquery
I created a sql in the database to Oracle 11 g Enterprise Edition Release 11.2.0.2.0 to purchase Oracle query tables. The user wants to know an estimate of the number of days it takes to approve a release as soon as it is created. I created a subquery, as follows:
Select Papf.Full_Name as the approver
Pah.Action_Date as Approved_Date
Por.Creation_Date
, Trunc (Pah.Action_Date) - Trunc (Por.Creation_Date) days
(Select Count (*)
From (select level, (Pah.Action_Date + 1) - level double My_Date)
Connect by level < Trunc(Pah.Action_Date+1) - Trunc (por.creation_Date)
() Where To_Char (My_Date, 'DY') ('MON', 'Mar', 'SEA', 'Game', 'Ven')) As Days2Approve
…
OF Apps.Po_Headers_All Poh
Apps.Po_Releases_All Por
Apps.Po_Lines_All Pol
…
Apps.Po_Action_History Pah
... etc.
When I run the application, I get the following error message:
ORA-00904: "POR". "' CREATION_DATE ': invalid identifier
00904, 00000 - '% s: invalid identifier '.
* Cause:
* Action:
Error on line: 193 column: 54
I know that the subquery conceptually strong because if I run the sql below with fake dates I get 17 which is correct.
Select Count (*)
From (SELECT level, (to_date (January 24, 2013 ') + 1)-level my_date From Dual)
Connect by level < Trunc (To_Date('24-JAN-2013') + 1) - Trunc (To_Date('01-JAN-2013'))
) Where To_Char (My_Date, 'DY') ('MON', 'Mar', 'SEA', 'Game', 'Ven')
How do Pah.Action_Date & por.creation_Date the subquery without getting what appears to be brought for violation?
…Hello
You can avoid the problem by not using is not a nested subquery:
( SELECT COUNT (*) FROM dual CONNECT BY LEVEL < TRUNC (pah.action_date + 1) - TRUNC (por.creation_date) WHERE TO_CHAR ( pah.action_date + 1 - LEVEL , 'DY' ) NOT IN ('SAT', 'SUN') ) AS days2approve
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
Explain, using specific examples, how you get these results from these data.
See the FAQ forum {message identifier: = 9360002} -
manipulation of the table problem
I'm using Labview 2009 and I have a problem with windows... I have to implement the following code in Labview (X and digital input boards):
for (i = 0 to MAX (X)) {}
If (X [i] > (X [i-1] + 1)) {}
X.Add (X [i], X [i-1] + 1) / / add the value X [i-1] + 1 x [i] position of the X table
Y [i] = 0
}
on the other
Y [i] = Y [i]
}
If I try to add items in the original array Y with the function 'Replace subset of table', the output array is not changed by the VI. If I try to initialize and to build a new table, I get a matrix of zeros. Can someone help me?
If you want to just add 0 to the index that does not exist in X [] then try this.
-
Oracle 11G - access to the table problem
Hello
New on Oracle IAM... After you create a database, I created a connection and SYSDBA role...
And then I create a table called Table1. And then I create a new USER and I Connect with the same SID of the database, but the role has the DEFAULT value for this new USER...
01. but the problem is that I can't find the Table1 table for this new user... so how acess as Table1...?
02. I came to know in Oracle, also we can design forms for the frontend and can generate EXE... Is this true?
03. in SQL Server - Sql Port with static IP - we have access to the database for remote users... Is it possible for Oracle?
Thanks for the directions...997497 wrote:
Hello
New on Oracle IAM... After you create a database, I created a connection and SYSDBA role...What the user did you use to connect? I'm guessing that you logged in as SYS
And then I create a table called Table1. And then I create a new USER and I Connect with the same SID of the database, but the role has the DEFAULT value for this new USER...
So I guess that you have created the table in the SYS schema. You should never, ever create user objects in the SYS schema. If you have created the table in the SYS schema, you really need to drop and create in a more appropriate scheme.
You indicate that you come from SQL Server, so there may be a question of terminology. Which refers to SQL Server as a "database" is roughly equivalent to what Oracle designates as a "scheme." An Oracle database contains many schemas. A schema is the set of objects owned by a particular user.
01. but the problem is that I can't find the Table1 table for this new user... so how acess as Table1...?
As I said above, you really, really should not create objects in the SYS schema. If you really want, however, you need to log the SYS schema and grant access on the table to your new user
GRANT SELECT ON sys.table1 TO your_new_user
You will then need to fully qualify the table name in your SELECT (or create a synonym or the current_schema)
SELECT * FROM sys.table1
02. I came to know in Oracle, also we can design forms for the frontend and can generate EXE... Is this true?
Older versions of Oracle Forms would create server executables. The modern versions are used to create three-tier applications. You can also use APEX to build web applications. Of course, you can also generate executables by writing code in another language (often .net).
03. in SQL Server - Sql Port with static IP - we have access to the database for remote users... Is it possible for Oracle?
Is this possible? Sure. Depending on what means "remote users", however, it may be poorly advised - you would never open a database to the internet directly, for example, you want to ensure that the remote users are connected to your network (via a virtual private network).
Justin
-
creating table using joins in the subquery
can we create a table using joins in the subquery?
Like this
create table emp in select * from employee e, Department d
where d.department_id = e.department_id
??
We can?987018 wrote:
We can?Yes, as long as you column alias names common to both tables to make them unique.
SY.
-
problem in the form of master-detail when you use the ADF table for detail
Hello
jdev version - 11.1.2.1.0
I create master shape detail using datacontrol drag as ADF master shape secondary Table.
Now when I create a new line in the detail table using the key CreateInsert a new empty row created on top of the secondary table.
and other show line that the previous record data based on the master.
problem is I want to when I click on the createInsert button all the line of the secondary table must be empty and what line to fill two or three user then validate.
Thanks in advanceHello
If a secondary table has data, then createInsert adds to them. If you want to hide the existing lines, create a new instance of the View object and set the option "extract database" to "No. Rows. Use an af:switcher to change the specified table when the user clicks the createInsert button. There is some coding needed to have this use case in the ADF, but its essentially declarative. Bottom line, is that there is no option automated other than to create new lines in a separate page or dialog box if you are bothered by existing lines
Frank
-
Calc problem with fact table measure used in the bridge table model
Hi all
I have problems with the calculation of a measure of table done since I used it as part of a calculation in a bridge table relation.
A table of facts, PROJECT_FACT, I had a column (PROJECT_COST) whose default aggregate is SUM. Whenever PROJECT_COST was used with any dimension, the appropriate aggregation was made at appropriate levels. But, no more. One of the relationships that project_fact is a dimension, called PROJECT.
PROJECT_FACT contains details of employees, and every day they worked on a project. So for one day, employee, Joe, could have a PROJECT_COST $ 80 to 123 project, the next day, Joe might have $40 PROJECT_COST for the same project.
Dimension table, PROJECT, contains details of the project.
A new feature has been added to the software - several customers can now be charged to a PROJECT, where as before, that a single client has been charged.
This fresh percentage collapse is in a new table - PROJECT_BRIDGE. PROJECT_BRIDGE has the project, CUSTOMER_ID, will BILL_PCT. BILL_PCT always add up to 1.
Thus, the bridge table might look like...
CUSTOMER_ID BILL_PCT PROJECT
123 100.20
123 200.30
123 300.50
456 400 1.00
678 400 1.00
Where to project 123, is a breakdown for multiple clients (. 20,.30.50.)
Let's say in PROJECT_FACT, if you had to sum up all the PROJECT_COST for project = 123, you get $1000.
Here are the steps I followed:
-In the physical layer, PROJECT_FACT has a 1:M with PROJECT_BRIDGE and PROJECT_BRIDGE (a 1:M) PROJECT.
PROJECT_FACT = > PROJECT_BRIDGE < = PROJECT
-In the logical layer, PROJECT has a 1:M with PROJECT_FACT.
PROJECT = > PROJECT_FACT
-Logical fact table source is mapped to the bridge table, PROJECT_BRIDGE, so now he has several tables, it is mapped (PROJECT_FACT & PROJECT_BRIDGE). They are defined for an INTERNAL join.
-J' created a measure of calculation, MULT_CUST_COST, using physical columns, which calculates the sum of the PROJECT_COST X the amount of the percentage in the bridge table. It looks like: $ (PROJECT_FACT. PROJECT_COST * PROJECT_BRIDGE. BILL_PCT)
-J' put MULT_CUST_COST in the presentation layer.
We still want the old PROJECT_COST autour until it happened gradually, it is therefore in the presentation layer as well.
Well, I had a request with only project, MULT_CUST_COST (the new calculation) and PROJECT_COST (the original). I expect:
PROJECT_COST MULT_CUST_COST PROJECT
123. $1000 $1000
I'm getting this for MULT_CUST_COST, however, for PROJECT_COST, it's triple the value (perhaps because there are quantities of 3 percent?)...
PROJECT_COST MULT_CUST_COST PROJECT
123 $1000 (correct) $3000 (incorrect, it's been tripled)
If I had to watch the SQL, you should:
SELECT SUM (PROJECT_COST),
SUM (PROJECT_FACT. PROJECT_COST * PROJECT_BRIDGE. BILL_PCT),
PROJECT
Of...
PROJECT GROUP
PROJECT_COST used to work properly at a table of bridge of modeling.
Any ideas on what I got wrong?
Thank you!Hello
Phew, what a long question!
If I understand correctly, I think the problem is with your old measure of cost, or rather that combines with you a new one in the same request. If you think about it, your request as explained above will bring back 3 rows from the database, that's why your old measure of cost is multiplied. I think that if you took it out of the query, your bridge table would work properly for the only new measure?
I would consider the migration of your historical data in the bridge table model so that you have one type of query. For historical data, each would have a single row in the bridge with a 1.0 BILL_PCT.
Good luck
Paul
http://total-bi.com -
Alignment of the Flash menu in table problem/margins between images
Hi, I built a website using Dreamweaver (I'm a complete newb to CSS and HTML, I'm a kiltmaker!). It uses a table layout that will connect eventually to a shopping cart. I'm just working on the html part, and I would include a Flash menu bar. When I add the SWF file, I would like to align with the top of my product images, but unfortunately, ends up looking like this:
http://amhamiltonhandmadekilts.co.UK/test/flashtestdresssporrans.html
I would really like it if the top of my menu flash would align at the same height as the rest of the images, for example at the same height as "dress sporran" etc so that the design is flush.
Any ideas on how I could solve this problem would be greatly appreciated!
Also, I would like that the spacing between the images were not as big table, so that it looks a bit neater, is this easy to do?
Thank you very much
Steve
I see you still seem to be placing the menu and products in the structure of the table. First create an external table which has two cells side by side. Make sure that the 100% table. In the left cell of the table, place the Flash menu with its setting valign to the cell. In the right cell of this place of menu a new table that contains only products. This approach allows you to remove any dependence on the menu arrangement of the products and vice versa.
Play with it in a new page of practice... feel free to try different things. I think it's good for you to gain experience with the handling of the page layout using tables. That way, if/when you move to the side of the css, you will be able to say why it is preferable (if you do) by personal experience, and not because someone else said it.
-
How to do a subquery in the same table?
I'm trying to figure out how to query inside a query...?
Here is my table:
NAME ID (PK)
My problem is when someone creates a new line in this table, the system creates other lines associated in the same table, but it fits the ID of the line of "parent" in the name of the new colums.
For example:
1001 BOB_ADDRESS
1002 FRED_ADDRESS
1003 NEW_ROW_1001_BOB_ADDRESS
1004 NEW_ROW1_1001_BOB_ADDRESS
1005 NEW_ROW_1002_FRED_ADDRESS
1006 NEW_ROW1_1002_FRED_ADDRESS
What I want is a query that would work to something like:
SELECT ID, NAME
FROM TABLENAME,
BY NAME;
But this query finds all rows of the child >
For example:
ID NAME
---- ---------------------------------------
1001 BOB_ADDRESS
1003 NEW_ROW_1001_BOB_ADDRESS
1004 NEW_ROW1_1001_BOB_ADDRESS
1002 FRED_ADDRESS
1005 NEW_ROW_1002_FRED_ADDRESS
1006 NEW_ROW1_1002_FRED_ADDRESS
1010 JOE_ADDRESS
1100 NEW_ROW_1010_JOE_ADDRESS
1117 NEW_ROW1_1010_JOE_ADDRESS
Any thoughts?
Thank you
KSL.Something like that?
SQL> select rectype, parentid, id, name 2 from ( 3 select 'Primary' rectype, t1.id parentid, t1.* 4 from t t1 5 where not exists (select null from t t2 where t1.name like '%'||t2.id||'%') 6 union all 7 select 'Child' rectype, (select max(id) from t t3 where t1.name like '%'||t3.id||'%') parentid, t1.* 8 from t t1 9 where exists (select null from t t2 where t1.name like '%'||t2.id||'%') 10 ) 11 order by parentid, rectype desc, id 12 ; RECTYPE PARENTID ID NAME ------- ---------- ---------- ------------------------------ Primary 1001 1001 BOB_ADDRESS Child 1001 1003 NEW_ROW_1001_BOB_ADDRESS Child 1001 1004 NEW_ROW1_1001_BOB_ADDRESS Primary 1002 1002 FRED_ADDRESS Child 1002 1005 NEW_ROW_1002_FRED_ADDRESS Child 1002 1006 NEW_ROW1_1002_FRED_ADDRESS 6 rows selected.
Maybe you are looking for
-
How can I get rid of the previous version of Firefox from applications?
I don't seem to be able to remove the old version of Firefox. I get the message that the application is open and therefore cannot be removed.
-
Okay, so I'm trying to update my Windows XP desktop computer to Windows 7, but when I put the disc for Windows 7 Home Premium, I get error message saying: "This installation disc is not compatible with your version of Windows. To upgrade, you need th
-
CD of Win - Original XP damaged
My cd of Win-XP-Prof. original was damaged. I don't have my keyword, PID. Can I get another CD/down load? Please suggest-
-
When my child's screen time is in place and it is allowed more time he can click on ask you parent button longer. launched an automated email to me that I can then click extend the time limit of the screen for a certain period of time. For the last t
-
Windows desktop extends beyond the edges of the screen to the external monitor.
I have a laptop Sony Vaio with Windows 7 Home Premium 64-bit. I connected the laptop to my Samsung HDTV via HDMI 24 ". I put it to only show the desktop on the HD TV, but the Office extends beyond the borders of the HDTV screen. The screen resolution