Help with multiple 'if' statement
If 'age' is greater than 17 and 'relationship' is also one of the other options as son or daughter, I would a subform to appear. Java or formcalc will be fine. Thanks for any help.
Hello
FormCalc script might look like:
if (Age gt 17) then if (relationship eq "son" or relationship eq "daughter") then subform.presence = "visible" else subform.presence = "invisible" endif endif
Tags: Adobe LiveCycle
Similar Questions
-
need help with the Update statement
Hello
I received a question in a course and I tried my best to respond, and now my brain is giving. I would really appreciate help with the update statement. I don't mind if you do not validate a solution, a little nudge in the right direction would be really useful. I'll post that I got.
THE QUESTION
/ * For these agents disabled on more than seven missions, change their date of deactivation of the first date of deactivation of all the agents that have been activated in the same year as the agent that you update currently.
*/
I have it divided into parts, here is my select statement to agents disabled on more than 7 missions, which produces the deactivation_dates in the agents table that I want to update...
.. .and the code for the first date of deactivation for each year of activation agentSELECT s.deactivation_date FROM ( SELECT a.deactivation_date, count(m.mission_id) as nomissions FROM agents a INNER JOIN missions_agents m on a.agent_id=m.agent_id GROUP BY a.deactivation_date ) s WHERE s.nomissions>7 AND s.deactivation_date IS NOT NULL
..... I am not real to marry these two statements together in the Update statement. I can't extract each date of deactivation produced in the first select statement and their match against the first date of deactivation in the year they have been activated for the second select statement.select a2.deactivation_date from agents a2 where a2.deactivation_date= ( select min(a.deactivation_date) from agents a where to_number(to_char(a.activation_date,'YYYY'))=to_number(to_char(a2.activation_date,'YYYY')) )
Any help greatly appreciated... :))I began to wonder how things would :)
user8695469 wrote:
First of all why he chooses the date the earliest of all agentsUPDATE AGENTS_COPY AC /* (1) */ SET DEACTIVATION_DATE = ( SELECT MIN(AGS.DEACTIVATION_DATE) FROM AGENTS_COPY AGS , AGENTS_COPY AC /* (2) */ WHERE TRUNC(AGS.ACTIVATION_DATE,'YEAR') = TRUNC(AC.ACTIVATION_DATE,'YEAR') /* (3) */ )
He recovers as soon as the subquery has not been correctly set in the SET clause. It seems you are trying to update a correlated, but we are still having a conceptual shift. I have added a few comments to your code above and below will explain.
(1): when you do a correlated update it is useful to the table alias that you did right here.
(2): this table statement is not necessary and is the reason why the FIRST deactivation date is selected. The alias that you use (3) refers to THIS table, not the one defined in the update statement. Remove the line indicated by (2) in the FROM clause and a correlated update will happen.
and secondly why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)
user8695469 wrote: then why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)
WHERE EXISTS ( SELECT a.agent_id, count(m.mission_id) FROM agents a /* INNER JOIN AC ON AC.AGENT_ID = A.AGENT_ID */ INNER JOIN missions_agents m ON a.agent_id=m.agent_id GROUP BY a.agent_id, a.deactivation_date HAVING count(m.mission_id)>7 AND a.deactivation_date IS NOT NULL )
Once again this problem is similar to the question above that a correlation update doesn't work. Test existence of lines in an EXISTS subquery. Since your subquery is not related to the table that you are trying to update, it will be always return a line and, therefore, it returns true for EACH LINE in the AGENTS table. To limit the game to only agents > 7 missions results, you need to add a join condition that references the table in your update statement. I added one above (with comments) as a sample.
I recommend you look over all material that you have associated with correlated subqueries, including documents that I posted above. This seems to be what you're having the problem more with. If you need me to explain the concept of correlated queries any better please let me know.
Thank you!
-
Help with the insert statement
Hello
I was wondering if someone could help write me a sql statement.
Here is my table:
Here are the instructions for correct insertion. This time, I posted 2 examples with 2 numbers different otherwise.CREATE TABLE "TEMP_INVOICE" ("INVOICE" VARCHAR2(100 BYTE), "DATE_OF_DOCUMENT" DATE, "DATE_OF_PAY_DAY" DATE, "D" NUMBER, "K" NUMBER );
I want to do is make an insert allows you to table another call is MADE:insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k) values (1000,to_date('01.02.2012','dd.mm.yyyy'),to_date('01.03.2012','dd.mm.yyyy'),5000,0); insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k) values (1000,to_date('01.04.2012','dd.mm.yyyy'),'','',1000); insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k) values (1000,to_date('01.05.2012','dd.mm.yyyy'),'','',3000); insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k) values (1000,to_date('01.06.2012','dd.mm.yyyy'),'','',1000); insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k) values (2000,to_date('01.07.2012','dd.mm.yyyy'),to_date('01.09.2012','dd.mm.yyyy'),8000,0); insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k) values (2000,to_date('01.10.2012','dd.mm.yyyy'),'','',5000); insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k) values (2000,to_date('01.11.2012','dd.mm.yyyy'),'','',2000); insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k) values (2000,to_date('01.12.2012','dd.mm.yyyy'),'','',1000);
Statements in the INVOICE table should be like this:CREATE TABLE "INVOICE" ("INVOICE" VARCHAR2(100 BYTE), "DATE_OF_DOCUMENT" DATE, "DATE_OF_PAY_DAY" DATE, "DATE_OF_PAYMENT_REC" DATE, "VALUE" NUMBER, "VALUE_DEDUCT" NUMBER, "DATE_FROM" DATE, "DATE_TO" DATE );
........ The Bill... date_of_document... date_of_pay_day... date_of_payment_rec... value... value_deduct... Date_from... Date_to
1...... 1000...............1.1.2012.................1.3.2012................NULL............................ 5000... NULL... 1.3.2012...1.4.2012
2...... 1000...............1.4.2012.................NULL..................... 1.4.2012...1000... 4000... 2.4.2012... 1.5.2012
3...... 1000...............1.5.2012.................NULL..................... 1.5.2012...3000... 1000... 2.5.2012... 1.6.2012
4...... 1000...............1.6.2012.................NULL..................... 1.6.2012...1000
Can someone help me with the sql statement that would insert data from table to table Bill temp_invoice as in the example?
Thank you!
PS
I would try to explain.
(1) the first statement that is to be inserted is original imply that at which is different DATE_OF_PAY_DAY to NULL.
To this inserted negative of the original imply, we must add date_from that is exatly the same date_of_pay_day and date_to which is exactly the same as the date of the first payment. Payment which came first!
(2) we have now in the second insert statement. It will be the first payment of lease with date_of_document and date_pf_payment_rec, which is the same as date_fo_document. Value field will be populated with the amount of payment received and value_deduct field will be the value of the original imply - value of the first payment. Date is date_of_document + 1 and date_to is the date of the next payment.
(3) Insert us the next installment. Date_od_payment_rec is the same as date_of_document... value is the amount of the second payment and value_deduct's previous value_deduct which was of 4000 - value of this second payment. date_from date_of_payment_rec + 1 and date_to is the date of the next payment
So we continue this same pattern until we reached the final payment when we finish insert with the statement:
Date of the document (date of the last payment received) and even for date_of_payment_rec and field value with the amount of the payment receieved. The rest (value_deduct, date_from, date_to) is null.
I really hope you understand what I'm trying to do here.
If you have any other questions please.
Published by: user13071990 on November 22, 2012 04:16
Published by: user13071990 on November 22, 2012 04:16Hello
user13071990 wrote:
... Here are the instructions for correct insertion. This time, I posted 2 examples with 2 numbers different otherwise.Ok!
Be sure to post the results you want new data.You probably need to add "PARTITION BY the Bill" to all analytical clauses in my solution:
INSERT INTO invoice ( invoice, date_of_document, date_of_pay_day, date_of_payment_rec , value, value_deduct, date_from, date_to ) SELECT invoice , date_of_document , date_of_pay_day , CASE WHEN k > 0 THEN date_of_document END AS date_of_payment_rec , NVL (d, k) AS value , NVL2 ( date_of_pay_day , NULL , SUM (d) OVER ( PARTITION BY invoice ORDER BY date_of_document ) - SUM (k) OVER ( PARTITION BY invoice ORDER BY date_of_document ) ) AS value_deduct , NVL ( date_of_pay_day , date_of_document + 1 ) AS date_from , LEAD (date_of_document) OVER ( PARTITION BY invoice ORDER BY date_of_document ) AS date_to FROM temp_invoice ;
Because I'm not an English speaker nativ, that I just posted what it should look like after the insert is successful.
OK, so you can't explain as you want, but you still need to explain.
... @Frank Kulash: you are very close, but still not quite what I'm looking for.
Point out where my solution is the production of incorrect results, and explain (as you can) how to get good results in these places.
-
Need help with the insert statement
Hello
I have a question on how to write a SQL statement.
This is the table of "base":
and it comes to resoult in the target table. SQL statement must take care of the insert in a base of the target table table (example below is already provided with test data).CREATE TABLE TEMP_TBL ( id_nr NUMBER, DATE_DOK DATE, DATE_DUE DATE, DATE_DOK_PAY DATE, DEB NUMBER, KRD NUMBER ); insert into temp_tbl (ID_NR,DATE_DOK,DATE_DUE,DATE_DOK_PAY,DEB,KRD)values('1',TO_DATE('11.01.2011','DD.MM.YYYY'),TO_DATE('25.02.2011','DD.MM.YYYY'),NULL,'423,24','0'); insert into temp_tbl(ID_NR,DATE_DOK,DATE_DUE,DATE_DOK_PAY,DEB,KRD)values('2',TO_DATE('16.12.2011','DD.MM.YYYY'),TO_DATE('13.06.2011','DD.MM.YYYY'),NULL,'91270,15','0'); insert into temp_tbl(ID_NR,DATE_DOK,DATE_DUE,DATE_DOK_PAY,DEB,KRD)values('3',TO_DATE('27.09.2011','DD.MM.YYYY'),TO_DATE('27.09.2011','DD.MM.YYYY'),NULL,'0','2000');
If someone could give me a helping hand how write correct insert statement I would be really gratefull.create table table_sod ( id_nr number ,date_from date ,date_to date ,deb_krd number ); One thing to note here : values in column deb_krd under insert 1 and 4 must be summarized in insert 4. insert into table_sod (id_nr,date_from,date_to,deb_krd) values('1',null,to_date('25.02.2011','dd.mm.yyyy'),'423,24'); insert into table_sod(id_nr,date_from,date_to,deb_krd) values('2',to_date('26.02.2011','dd.mm.yyyy'),to_date('13.06.2011','dd.mm.yyyy'),'423,24'); insert into table_sod(id_nr,date_from,date_to,deb_krd)values('3',null,to_date('13.06.2011','dd.mm.yyyy'),'91270,15'); insert into table_sod(id_nr,date_from,date_to,deb_krd)values('4',to_date('14.06.2011','dd.mm.yyyy')to_date('27.09.2011','dd.mm.yyyy'),'91693,39'); insert into table_sod(id_nr,date_from,date_to,deb_krd)values('5',null,to_date('27.09.2011','dd.mm.yyyy'),'2000');
Thank you for your time!I came here with my own assumptions with this
SQL> select rownum id_nr 2 , date_from 3 , date_to 4 , case when date_from is null then deb 5 else sum(case when date_from is not null then deb else 0end) over(order by id_nr, no) 6 end deb_krd 7 from ( 8 select id_nr 9 , case when lg_dt is null or ld_dt = date_due then null else lg_dt+1 end date_from 10 , ld_dt date_to 11 , case when deb = 0 then krd else deb end deb 12 , no 13 from ( 14 select t1.* 15 , lead(t1.date_due) over(order by t1.id_nr, t2.no) ld_dt 16 , lag(t1.date_due) over(order by t1.id_nr, t2.no) lg_dt 17 , t2.no 18 from temp_tbl t1 19 cross 20 join (select 1 no from dual union all select 2 no from dual) t2 21 order by id_nr, no 22 ) 23 where ld_dt is not null 24 ) 25 / ID_NR DATE_FROM DATE_TO DEB_KRD ---------- --------- --------- ---------- 1 25-FEB-11 42324 2 26-FEB-11 13-JUN-11 42324 3 13-JUN-11 9127015 4 14-JUN-11 27-SEP-11 9169339 5 27-SEP-11 2000
-
need help with the Merge statement
I'm on: Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
I'm currently an UPDATE statement and then it works and is accurate, it takes 30 minutes. I heard that MERGE
can do the same thing and is just as accurate and much faster!
Here's the query I want to convert into a MERGE INTO statement. I tried to do it myself, but I get errors and don't know simply, since it's new for me.
Basically I want to update table your on a corresponding condition in the table tt for 2 columns (GTP and UPDATE_DT), for UPDATE_DT I want to insert the Date current system.
Thank you!UPDATE /*+ PARALLEL (16) */ OLDER_Table ta SET (ta.GTP, ta.UPDATE_DT) = (SELECT /*+ PARALLEL (16) */ tt.GTP, SYSDATE FROM NEWER_Table tt WHERE ta.cust_id = tt.cust_id AND ta.STAMP_DATE = tt.STAMP_DATE AND ROWNUM = 1) WHERE EXISTS (SELECT 1 FROM NEWER_Table tt WHERE ta.cust_id = tt.cust_id AND ta.STAMP_DATE = tt.STAMP_DATE AND (NVL(ta.GTP, 'X') != NVL(tt.GTP, 'X')));
Hello
Whenever you have a problem, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) of all of the tables involved.
Also post the results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.
If you ask on a DML statement, such as UPDATE, CREATE TABLE and INSERT statements need to re - create the tables as they are before the DML, and results will be the content of the or the tables changed when it's all over.
See the FAQ forum {message identifier: = 9360002}MERGE peut be much faster than update; Sometimes, there is no significant difference in speed.
Tables in multiple situations like this, I've never seen a case where the MERGER has been slower than the UPDATE, even if the UPDATE is sometimes easier to code and just as fast.Maybe that's what you want:
MERGE INTO older_table dst USING ( SELECT n.cust_id , n.stamp_date , n.gtp , ROW_NUMBER () OVER ( PARTITION BY n.cust_id , n.stamp_date ORDER BY n.gtp ) AS r_num FROM newer_table n JOIN older_table o ON n.cust_id = o.cust_id AND n.stamp_date = o.stamp_date AND NVL ( n.gtp , 'X' ) != NVL ( o.gtp , 'X' ) ) src ON ( src.cust_id = dst.cust_id AND src.stamp_date = dst.stamp_date AND src.r_num = 1 ) WHEN MATCHED THEN UPDATE SET dst.gtp = src.gtp , dst.update_date = SYSDATE ;
As I can't test it, I can't be sure.
-
Helps with the UPDATE statement
Hello
I have a table like this:
data in the table:create table test (id number, stat number, id_num number);
I want to update the column id_num with serial number under the same ID.insert into table test (id,stat,id_num) values (1,112,''); insert into table test (id,stat,id_num) values (1,123,''); insert into table test (id,stat,id_num) values (2,134,''); insert into table test (id,stat,id_num) values (2,111,''); insert into table test (id,stat,id_num) values (3,112,''); insert into table test (id,stat,id_num) values (4,111,''); insert into table test (id,stat,id_num) values (4,12,''); insert into table test (id,stat,id_num) values (4,11,'');
Below is the table with coloumn successfully updated.
Can someone give me a hint how to remove this?insert into table test (id,stat,id_num) values (1,112,1); insert into table test (id,stat,id_num) values (1,123,2); insert into table test (id,stat,id_num) values (2,134,1); insert into table test (id,stat,id_num) values (2,111,2); insert into table test (id,stat,id_num) values (3,112,1); insert into table test (id,stat,id_num) values (4,111,1); insert into table test (id,stat,id_num) values (4,12,2); insert into table test (id,stat,id_num) values (4,11,3);
Thank you very much for your help!user13071990 wrote:
Manik which is not a good solution because dat_document can also be duplicated.Alberto is no uniq key in the table, which is the main problem.
It is not a good way to get the table without unique keys.
To work around the problem, I suggest that, despite the fact that I do not use virtual ROWID.
I did a test by inserting a date twice for the same id
insert into test (id,dat_document,id_num) values (4,to_date('01.07.2012','dd.mm.yyyy'),'');
Now, I used:
MERGE INTO test a USING (SELECT rowid , ROW_NUMBER () OVER (PARTITION BY id ORDER BY dat_document) AS val FROM test) b ON (a.rowid = b.rowid) WHEN MATCHED THEN UPDATE SET id_num = val; SELECT * FROM test ORDER BY id, dat_document; ID DAT_DOCUMENT ID_NUM ---------- --------------------- ---------- 1 01-01-2012 00:00:00 1 1 01-02-2012 00:00:00 2 2 01-03-2012 00:00:00 1 2 01-04-2012 00:00:00 2 3 01-05-2012 00:00:00 1 4 01-06-2012 00:00:00 1 4 01-07-2012 00:00:00 2 4 01-07-2012 00:00:00 3 4 01-08-2012 00:00:00 4
Kind regards.
Al -
Need help with the IF statement.
I am trying to write an IF statement using FormCalc in LiveCycle. I have the "tpe" cell that captures the total number of points. I would attribute levels based on the number of points obtained. For example, level I = 1001-1985; level II = 851-1000; level III = 551-850; level IV = < 551. I want to 'level' of cell to show I, II, III or IV, based on the points in the cell "tpe". How can I do this? I have zero familiarity with FormCalc or scripts in general. Can someone help me with this please? Would appreciate any help! Thank you!
Just put the script in the field calculate level instead:
If (tpe tpe and > 1000<= 1985)="">=>
$ = "I"
ElseIf (tpe > 850 and tpe<= 1000)="">=>
$ = « II »
ElseIf (tpe > 550 and tpe<= 850)="">=>
$ = 'III'
ElseIf (tpe<= 550)="">=>
$ = « IV »
else $ = «»
endif
Also just have a glance to your form - for the next time that you could save yourself a lot of time in your configuration through the use of tables for all of these fields, rather than making each a numeric field separated.
-
Help with multiple parameter search recordset
I have a mysql table that is sought by both city and State fields
using dreamweaver, I've created a form with a text field as a city as well as a list as State and me passed with the get method.
The problem is on the results page, I have a Recordset, SELECT * FROM table name. What I do with the WHERE, I tried several configurations, and I can't get anything to work. I only want to search by two fields, city and State. The State must be, but if the city is empty, I still want to filter by status.
Can someone help me or point me in the right direction, please?Thanks, but I understood my problem and I no longer need help.
-
I implement my application using state machines, and I have the following problem.
1. I have an initialized state that initialize my controls.
2. then, I want the next State to check user input. (Boolean button will be be supported to determine what state is planned).
3. in one of the States, I want the user to be able to change the values initialized and then return to the State of user input, in order to determine what state is expected
I put in place the initialization state, but also the State of user input (use event structure for this report), but I don't know how to let the user may change the values of my control, the user acknowledges the change then the State goes back to the State of waiting for the next state user input.
Thanks for any help
Your user input is also what I would call an idle state. If nothing happens, it just goes back to itself. (Put some statement waiting there so that the idle state is not acting as a "greedy loop".) If change is found, then instead of the called resting State, the initialization state is called again. The initialization state is running and when it's done it goes back to idle input state.
-
Help with multiple locations on a XY graph under certain conditions
Hi, I have a question about manipulating a XY Chart.
(1) whenever the plot crosses the x-axis for value go to the top, I want the plot to change color, so that it crosses 0 will go back to the top, and I want that specific portion having a different color. It's really hard to explain, so I'll post a picture:
[URL =http://img691.imageshack.us/i/xygraphexample.jpg/] [IMG] http://img691.imageshack.us/img691/4540/xygraphexample.jpg [LINE] [URL]
As you can see, if the graph we cross the x-axis by decreasing, it should not change color. Only increase.
I can't understand how to do this. I know it will take more than one location, but how would I randomly change the color as well as detect if its path that goes to the top or not.
Any help would be appreciated.
Thank you
OK - chance I'm not too busy today...
Usually, I use either screw express, but was looking for a quick solution for you.
Here's the sample made with only the basic trigger function - no express VI.
Also added a selectable threshold by the user.
Then, on the space between the plots, if there is no data in the original, there no data in the colors either.
See second attachment
-
help with if else statement and math.random
Hi a little new to js and need to fill in a text field with the text selected randomly from a range when a button depending on what is put into another text field that is also randomly.
I really hope that makes sense but here is code that I got so far
var bg = this.getField("Background").valueAsString;
var pt_sage = new array();
pt_sage [0] = 'of the text based on background. "
pt_Sage [1] = 'of the text based on background. "
var i = Math.floor (2 * Math.random ())
var pt_hermit = new array();
pt_hermit [0] = "text".
pt_hermit [1] = "text more»
var v = Math.floor (2 * Math.random ())
If (bg == 'Wise') {}
this.getField("PersonalityTraits").value = pt_Sage [i];
} else (bg == 'Hermit') {}
this.getField("PersonalityTraits").value = pt_hermit [v];
}
I hope someone can help and thanks in advance
You must change this:
var pt_sage = new array();
To do this:
var pt_sage = new Array();
Better yet, change it to:
var pt_sage = ["a text based on the merits," "a text based on the"];
-
Need help with multiple certificates in a course.
Hello. I'm new to Captivate.
I'm working on a course where there is more than one certificate at the end of the course. This is because it is a training course, but is taken by people who, although they do the same exact material, have different requirements on their certificates according to their profession. My problem is that I have to lead the student to one of the three certificates. Is that what I can have a drop down at the beginning of course where the student chooses their profession, then based on this variable, goes to the appropriate end of the course after certificate that they have completed the quiz? Thank you!
Hello
Thank you to the Adobe community.
You can perform the task mentioned above using advanced actions. You can create a fast action with clues.
For example: you can put a box of text at the beginning of the project with captions for their respective profession. You can give to each profession, a trade for example, id 1 to 11, profession 2 id has 12 and so forth.
Now the user will enter the id in the text entry box and it will speak to a particular section of the course according to their profession.
You must use this advanced action on the text input area.
Please refer to the below images:
The first page:
The advanced Actions panel:
Where on 11, 12 and 13 at the top are the clues for profession 2 and 3.
I hope this helps!
Thank you!
-
Help with a SQL statement...
Hello...
I have tried to find a way to write a SQL statement and may not seem to produce something that works. What I need is a set of results that returns each month that a given task is in an open State. The only columns that I have in my work table with are TASK_NM, OPEN_DT and CLOSED_DT.
So if I have a line containing the following: TASK_NM = 'task one', OPEN_DT = April 18, 10 ' and CLOSED_DT = 14 October 10 '... I would like to see as a result set that looks like:
TASK_NM YEAR JAN FEB MAR APR MAY JUNE JULY AUG SEP OCT NOV DEC
the task of a 2010 0 0 0 1 1 1 1 1 1 1 0 0
Is it still possible?
Thanks in advance,
David.
Published by: user13027968 on March 10, 2011 14:19
Published by: user13027968 on March 10, 2011 15:13Hello
Welcome to the Forum!
Whenever you have a question. Please post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data.
For example, the sample data may be:CREATE TABLE table_x ( task_nm VARCHAR2 (10) , open_dt DATE , closed_dt DATE ); INSERT INTO table_x (task_nm, open_dt, closed_dt) VALUES ('task a', DATE '2010-04-18', DATE '2010-10-14'); INSERT INTO table_x (task_nm, open_dt, closed_dt) VALUES ('foo', DATE '2010-10-31', DATE '2011-01-01'); INSERT INTO table_x (task_nm, open_dt, closed_dt) VALUES ('foo', DATE '2010-12-01', DATE '2011-02-21'); INSERT INTO table_x (task_nm, open_dt, closed_dt) VALUES ('foo', DATE '2011-04-01', DATE '2011-04-30'); INSERT INTO table_x (task_nm, open_dt, closed_dt) VALUES ('bar', DATE '2010-01-01', DATE '2010-01-01');
From this data, you may want these results:
TASK_NM YEAR JAN FEB MAR APR MAY JUN JUL AUG SEP OVT NOV DEC ---------- ----- --- --- --- --- --- --- --- --- --- --- --- --- bar 2010 1 0 0 0 0 0 0 0 0 0 0 0 foo 2010 0 0 0 0 0 0 0 0 0 1 1 1 foo 2011 1 1 0 1 0 0 0 0 0 0 0 0 task a 2010 0 0 0 1 1 1 1 1 1 1 0 0
I'm not sure eactly how you plan to use it. Are there lines that overlap for the name of the task? You always want the same number of columns? What version of Oracle are you using?
I think you want something like this:WITH got_month_cnt AS ( SELECT task_nm , TRUNC (open_dt, 'MONTH') AS first_month , 1 + MONTHS_BETWEEN ( TRUNC (closed_dt, 'MONTH') , TRUNC (open_dt, 'MONTH') ) AS month_cnt FROM table_x -- WHERE ... -- If you want any filtering, put it here ) , cntr AS ( SELECT LEVEL AS n FROM ( SELECT MAX (month_cnt) AS max_month_cnt FROM got_month_cnt ) CONNECT BY LEVEL <= max_month_cnt ) , all_months AS ( SELECT m.task_nm , ADD_MONTHS ( m.first_month , c.n - 1 ) AS open_month FROM got_month_cnt m JOIN cntr c ON c.n <= m.month_cnt ) SELECT task_nm , EXTRACT (YEAR FROM open_month) AS year , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Jan' THEN 1 ELSE 0 END) AS jan , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Feb' THEN 1 ELSE 0 END) AS feb , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Mar' THEN 1 ELSE 0 END) AS mar , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Apr' THEN 1 ELSE 0 END) AS apr , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'May' THEN 1 ELSE 0 END) AS may , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Jun' THEN 1 ELSE 0 END) AS jun , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Jul' THEN 1 ELSE 0 END) AS jul , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Aug' THEN 1 ELSE 0 END) AS aug , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Sep' THEN 1 ELSE 0 END) AS sep , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Oct' THEN 1 ELSE 0 END) AS ovt , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Nov' THEN 1 ELSE 0 END) AS nov , MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Dec' THEN 1 ELSE 0 END) AS dec FROM all_months GROUP BY task_nm , EXTRACT (YEAR FROM open_month) ORDER BY task_nm , year ;
This will work in Orfacle 9 (and), but from Oracle 11, you could simplify it a little bit by using SELECT... Function PIVOT.
Published by: Frank Kulash, March 10, 2011 16:51
-
Help with multiple video Source on DVD
I'm new to first 9 trying to make a DVD of a birthday party with the video from my Canon Vixia HF200 and a slideshow that I exported from iPhoto to an m4v file. It is my understanding from reading messages earlier I have to export the Flash movie, I did apart and export 'for display on computer or do DVD"and then do the same for the slide show. But instead of an avi file, it is a flv file and I'm unable to open or import the first page 9 to create a DVD. I'm really confused on how to put these two files together to make a DVD. (I can not put everything together on the same project?) I have an iMac computer and am used to make films in iMovie where you can simply add clips from various sources and then export to iDVD. I find it difficult to get the help that I need in the Help menu of the program. I know I have to do something wrong. Please help if you can.
I'm confused myself.
Yes, you can get out the WebDVD from the same project, that you left your MPEG.
-
Help with multiple Gradients on the layer mask
I was watching a tutorial and I saw someone using multiple gradients on the same layer mask. When I try everything that is happening, it's photoshop to erase the last of them, I applied. An example would be using a gradient on the four corners of an image, but of different variations.
Any help is appreciated!
I use CS4, I don't know if that makes a difference?
Or multiplying the mixture on the gradient. Screen to display
Maybe you are looking for
-
HOW ADBLOCK ON WEBSITE AD SHOWING CLOSE SIDE BAR
HOW TO ADBLOCK IN WEB AD SHOWING NEAR BAR SIDE TOP AND BOTTOM OF THE POP-UP WINDOW WHEN I USE ADBLOCK TOOL I CAN'T OPEN WEB SITE NOT CORRECTLY SO GUIDE ME THAT WHAT SHOULD I DO
-
Is there a way to block the sharing sidebar?
I go to certain pages and they have this irritating framed shares which blocks the content of the page. Is blocking anyway?
-
where are my favorites saved in my Vista PC
Where are my bookmarks stored in my Vista PC?
-
I bought a replacement computer and installed my old hard drive as primary and came up saying 'this copy is not genuine' how bo I regesture it? It is not new it with my stuff in an old Emachine XP
-
Explorer Windows continues to stop. Help please.
I am writing in hopes that you can help me with the Windows Explorer. I use Firefox and my Vista 32 System. In the last 2 days, a box appeared in the middle of my screen saying "Windows Explorer has stopped working". Then it gives me two options 1.