Get the date range min/max for consecutive events.
Hi all...
I am fairly new to the programming of the DB and is working on some examples I picked up a few places. The database version is 10g R2.
I would like to configure the data here and I can explain my requirement.
create table table_1 (product_id varchar2(25), region_id number, event_id number event_date date, event_status number(1)) /
Now the data because it is->
insert into table_1 values ('Prod-1',10, null, to_date('01-feb-2014','dd-mon-yyyy'),null) / insert into table_1 values('Prod-1',10, 1001, to_date('10-mar-2014','dd-mon-yyyy'), 1) / insert into table_1 values('Prod-1',10, 1001, to_date('20-mar-2014','dd-mon-yyyy'), 3) / insert into table_1 values('Prod-1',10,1002, to_date('01-apr-2014','dd-mon-yyyy'), 1) / insert into table_1 values('Prod-1',10, 1002, to_date('10-apr-2014','dd-mon-yyyy'), 3) / commit /
If the table now contains the following data
select * from table_1;
PRODUCT_ID REGION_ID EVENT ID EVENT_DAT EVENT_STATUS
------------------------- ---------- -------- --------- ------------
Prod-1 10 1 February 14
Prod-1 10 1001 10 March 14 1
Prod-1 10 1001 20 March 14 3
Prod-1 10 1002 1 April 14 1
Prod-1 10 1002 April 10, 14 3
Now, the condition is as follows:
Above is the dates start and end for the tests on a product in a given region. The event_status column indicates the dates of beginning and end. Event_status = 1, for the date of beginning and the event_status = 3 of the end date.
A new event is now coming from March 21 and ending on March 31.
The power required is a product identifier / region; If there are events that are ending and then count the days, for example, 1001 to end on March 20, but now the new event begins on 21 March... and the new event ends on 31 March and event 1002 begins 01 - Apr... and so on.
The output required for this is as follows:
PRODUCT_ID REGION_ID EVENT_MIN_DATE EVENT_MAX_DATE
------------------------- ---------- -------------- --------------
Prod-1 10 10 14 March 10 April 14
The output should give a product identifier / region, when events are immediately after the other, out the min date of beginning and end of max for all these manifestations of "back to back".
Now I wrote the code for this, but it goes into a purely 'loop' for application in PLSQL... But my head tells me that if the results are correct. the PLSQL implementation is not the most efficient and effective way.
Can someone help me to form the query? I tried to use functions analytical min/max but it gives me the start and end dates back even if my events are not "back to back" or previous/succeed each other... so my query result is not quite correct.
Am reading on the TYPE clause but would be grateful if someone could help me with this query... or any other form better to implement this event so PLSQL can be used. The database version is 10g R2.
Thank you
K
PS - The number of such events back to back is limited to 4 and the events could be created in any order. But if someone could help me with the scenario above; am sure I could make a request addressed to any change in the order. :-)
No this isn't a recursive with clause, perhaps the UNION ALL you got confused. She will work with 10g.
Since there are 2 tables that you said, the block all_data brings together only the lines of the two tables. table_1 start_date and end_date are built from the event_status (where the max in group by).
Tags: Database
Similar Questions
-
SUM (case use this structure to get average values on the date range
I use:
Oracle SQL Developer (3.0.04) build hand - 04.34 Oracle Database 11 g Enterprise Edition 11.2.0.1.0 - 64 bit Production
How do we use the function sum with a structure of matter inside.
so I gave that looks like have an ID, date and value. I'm looking to get the day 7 medium for the date range of 04/01/2013 to 20/04/2013
* Please let me know if the table does not load.with t as ( select 1 ID_Key,to_date('4/1/2013','mm-dd-yyyy') date_val, 10 Value_num from dual union all select 1 ID_key,to_date('4/2/2013','mm-dd-yyyy'), 15 from dual union all select 1 ID_key,to_date('4/3/2013','mm-dd-yyyy'), 20 from dual union all select 1 ID_key,to_date('4/5/2013','mm-dd-yyyy'), 0 from dual union all select 1 ID_key,to_date('4/8/2013','mm-dd-yyyy'), 12 from dual union all select 1 ID_key,to_date('4/9/2013','mm-dd-yyyy'), 8 from dual union all select 1 ID_key,to_date('4/10/2013','mm-dd-yyyy'), 6 from dual union all select 1 ID_key,to_date('4/12/2013','mm-dd-yyyy'), 10 from dual union all select 1 ID_key,to_date('4/13/2013','mm-dd-yyyy'), 0 from dual union all select 1 ID_key,to_date('4/14/2013','mm-dd-yyyy'), 0 from dual union all select 1 ID_key,to_date('4/15/2013','mm-dd-yyyy'), 10 from dual union all select 1 ID_key,to_date('4/16/2013','mm-dd-yyyy'), 5 from dual union all select 1 ID_key,to_date('4/17/2013','mm-dd-yyyy'), 2 from dual union all select 1 ID_key,to_date('4/20/2013','mm-dd-yyyy'), 3 from dual union all select 2 ID_key,to_date('4/3/2013','mm-dd-yyyy'), 12 from dual union all select 2 ID_key,to_date('4/5/2013','mm-dd-yyyy'), 15 from dual union all select 2 ID_key,to_date('4/6/2013','mm-dd-yyyy'), 5 from dual union all select 2 ID_key,to_date('4/7/2013','mm-dd-yyyy'), 7 from dual union all select 2 ID_key,to_date('4/9/2013','mm-dd-yyyy'), 10 from dual union all select 2 ID_key,to_date('4/11/2013','mm-dd-yyyy'), 5 from dual union all select 2 ID_key,to_date('4/12/2013','mm-dd-yyyy'), 0 from dual union all select 2 ID_key,to_date('4/13/2013','mm-dd-yyyy'), 0 from dual union all select 2 ID_key,to_date('4/15/2013','mm-dd-yyyy'), 6 from dual union all select 2 ID_key,to_date('4/16/2013','mm-dd-yyyy'), 8 from dual union all select 2 ID_key,to_date('4/17/2013','mm-dd-yyyy'), 0 from dual union all select 2 ID_key,to_date('4/18/2013','mm-dd-yyyy'), 10 from dual union all select 2 ID_key,to_date('4/19/2013','mm-dd-yyyy'), 5 from dual )
I would get the average of 7 days, as long as there is date for the rank of enough previous dates, is it not, then it returns a null value.
the results should look like this
As you can see, there are gaps in the dates, the value is then processed by zeros for the 7Day_Avg and then ignored for the 7Day_Avg2 (not counted in the number of days on average do to no valu_num line)ID_Key date_val Value_num 7Day_Avg 7Day_Avg2 1 4/1/2013 10 null null 1 4/2/2013 15 null null 1 4/3/2013 20 null null 1 4/5/2013 0 null null 1 4/8/2013 12 6.71 11.75 1 4/9/2013 8 5.71 10.00 1 4/10/2013 6 3.71 6.50 1 4/12/2013 10 5.14 9.00 1 4/13/2013 0 5.14 7.20 1 4/14/2013 0 5.14 6.00 1 4/15/2013 10 4.86 5.67 1 4/16/2013 5 4.42 5.17 1 4/17/2013 2 3.85 4.50 1 4/20/2013 3 2.86 4.00 2 4/3/2013 12 null null 2 4/5/2013 15 null null 2 4/6/2013 5 null null 2 4/7/2013 7 5.57 9.75 2 4/9/2013 10 7.00 9.80 2 4/11/2013 5 6.00 8.40 2 4/12/2013 0 3.86 5.40 2 4/13/2013 0 3.14 4.40 2 4/15/2013 6 3.00 4.20 2 4/16/2013 8 2.71 3.80 2 4/17/2013 0 2.71 3.17 2 4/18/2013 10 3.43 4.00 2 4/19/2013 5 4.14 4.83
I tried something like this at first, but becomes "missing keyword" error
Should I have the structure outside the sum function?select t.*/, sum( case when date_val between :day2 - 6 and :day2 then value_num between date_val - 6 and date_val else null end ) as 7Day_avg form t
Any thoughts?
Published by: 1004407 on June 7, 2013 11:06Hello
If you want to calculate the average of the last 7 days, including the current day, then then RANGE should be 6 PRIOR, not 7.
Try this:
WITH got_min_date_val AS
(
SELECT id_key, date_val, value_num
MIN (date_val) compared to (AS min_date_val)
T
WHERE the date_val BETWEEN TO_DATE (April 1, 2013 ', "dd-mm-yyyy")
AND TO_DATE (April 20, 2013 ', "dd-mm-yyyy")
)
SELECT id_key, date_val, value_num
CASE
WHEN date_val > = min_date_val + 6
THEN SUM (value_num) OVER (PARTITION BY id_key
ORDER BY date_val
PRIOR TO TIER 6
)
/ 7
END AS avg_7_day
CASE
WHEN date_val > = min_date_val + 6
THEN AVG (value_num) OVER (PARTITION BY id_key
ORDER BY date_val
PRIOR TO TIER 6
)
END AS avg_7_day_2
OF got_min_date_val
ORDER BY id_key
date_val
;
Output:
ID_KEY DATE_VAL VALUE_NUM AVG_7_DAY AVG_7_DAY_2
---------- --------- ---------- ---------- ------------
1 1 APRIL 13 10
1 2 APRIL 13 15
1 APRIL 3, 13 20
1 5 APRIL 13 0
1 APRIL 8, 13 12 6.71 11.75
1 APRIL 9, 13 8 5.71 10.00
1 APRIL 10 13 6 3.71 6.50
1 12 APRIL 13 10 5.14 9,00
1 13 APRIL 13 0 5,14 7.20
1 14 APRIL 13 0 5,14 6.00
1 15 APRIL 13 10 4.86 5.67
1 16 APRIL 13 5 4.43 5.17
1 APRIL 17, 13 2 3.86 4.50
1 APRIL 20, 13 3 2.86 4.00
2 APRIL 3, 13 12
2 5 APRIL 13 15
2 6 APRIL 13 5
2 7 APRIL 13 7 5.57 9.75
2 9 APRIL 13 10 7,00 9.80
2 11 APRIL 13 5 6.00 8.40
2 12 APRIL 13 0 3.86 5.40
2 13 APRIL 13 0 3.14 4.40
2 15 APRIL 13 6 3.00 4.20
2 16 APRIL 13 8 2.71 3.80
2 17 APRIL 13 0 2.71 3.17
2 18 APRIL 13 10 3.43 4.00
2 APRIL 19, 13 5 4.14 4,83
Post edited by: FrankKulash
Sorry; I wanted to respond to OP, not Greg
-
Generic host win32 problem...
HI, I have soundcards XP SP2, version 2002. Whenever I caonnect my internet home, McAfee start poping of alerts, and after a few minutes (5-10 min) get the errors of generic host for Win32 process has encountered a problem and must be closed. After all that, my internet stops working and against hepatitis a to erboot to make it work again. Help, pleaseHello
· Did you do changes on the computer before the show?
Follow these methods.
Method 1: Follow these steps:
Step 1: Start the computer in safe mode with network and check if the problem persists.
Step 2: If the problem does not still in safe mode, perform a clean boot to see if there is a software conflict as the clean boot helps eliminate software conflicts.
Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state of the link to return the computer to a Normal startupmode.
After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.
(a) click Start, run.
(b) type msconfigand click OK.
(c) the System Configuration Utility dialog box appears.
(d) click the general tab, click Normal startup - load all services and device drivers and then click OK.
(e) when you are prompted, click on restart to restart the computer.
Method 2: Temporarily disable the security software.
Note: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you do not disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network during the time that your antivirus software is disabled, your computer is vulnerable to attacks.
Method 3: Follow the steps in the article.
How to troubleshoot a network home in Windows XP
Windows wireless and wired network connection problems
For reference:
-
Is there a way to get the data for submission of form of eloqua using the REST API?
I was wondering if there is a way to get the data for submission of form of eloqua using the REST API?
Thank you
On the page that egan related, there is a 'RawData' field for FormSubmit activities. In this area, the raw sending the form query string is returned.
Whatever it is, you can get this info from the activities of the API block, or the endpoints data Rest API.
-
Compare and get the data in the tables (see post for details)
I have two tables TableA and TableB. I struggle to write a query to get the dates of TableB (instead of TableA dates) where TableA dates don't coincide with the tableB (beginning and end).
Example 1: For account A1234,.
TableA got 2 rows 1/31/2014-3/3/2014 (which corresponds to TableB row), but TableA got another rank 31/01/2014 - 31/01/2014 that corresponds with the date of TableB Begin. In this case, I'm looking for output as below,
Use TableB start and end date and combine number two rows from TableA for this account
ACCOUNT TableB_BEGIN TableB_END AMOUNT A1234 31/01/2014 03/03/2014 100.0000000000 Example 2: For the B7777 account.
TableA end date aligns with the end dates of TableB for this account, in this case I want out put as,.
Use TableB start and end date and get the amount of TableA
ACCOUNT TableB_BEGIN TableB_END AMOUNT B7777 05/04/2013 06/05/2013 200.0000000000 Example 3: On behalf of D5555,.
Even a TableA line corresponds with TableA, there are two other rows in TableA matching start date with TableA and correspondence with the end date with TableA, in this case, that I put as,.
Use TableB start and end date and combine number three rows from TableA for this account.
ACCOUNT TableB_BEGIN TableB_END AMOUNT D5555 08/08/2014 10/09/2014 1100.0000000000 Example 4: To account E6666.
Table corresponds to a row with TableB and no additional lines in TableA, just display the data in A table
Tables and data:
create table TableA ( Account varchar2(10) not null, Begin date not null, End date not null, Amount number(19,10) not null ) ; create table TableB ( Account varchar2(10) not null, Begin date not null, End date not null, Amount number(19,10) not null ) ; TableA Data: insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('31-01-2014', 'dd-mm-yyyy'), 0.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('03-03-2014', 'dd-mm-yyyy'), 100.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('B7777', to_date('18-04-2013', 'dd-mm-yyyy'), to_date('06-05-2013', 'dd-mm-yyyy'), 120.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('C6666', to_date('25-06-2014', 'dd-mm-yyyy'), to_date('08-07-2014', 'dd-mm-yyyy'), 10.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('16-08-2014', 'dd-mm-yyyy'), 1000.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 0.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('D5555', to_date('16-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 100.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('E6666', to_date('01-01-2014', 'dd-mm-yyyy'), to_date('01-02-2014', 'dd-mm-yyyy'), 100.0000000000); TableB Data: insert into tableb (ACCOUNT, BEGIN, END, AMOUNT) values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('03-03-2014', 'dd-mm-yyyy'), 100.0000000000); insert into tableb (ACCOUNT, BEGIN, END, AMOUNT) values ('B7777', to_date('05-04-2013', 'dd-mm-yyyy'), to_date('06-05-2013', 'dd-mm-yyyy'), 200.0000000000); insert into tableb (ACCOUNT, BEGIN, END, AMOUNT) values ('C6666', to_date('06-06-2014', 'dd-mm-yyyy'), to_date('08-07-2014', 'dd-mm-yyyy'), 10.0000000000); insert into tableb (ACCOUNT, BEGIN, END, AMOUNT) values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 1100.0000000000); insert into tableb (ACCOUNT, BEGIN, END, AMOUNT) values ('E6666', to_date('01-01-2014', 'dd-mm-yyyy'), to_date('01-02-2014', 'dd-mm-yyyy'), 100.0000000000); SELECT A.ACCOUNT, A.BEGIN, A.END, A.AMOUNT, B.ACCOUNT, B.BEGIN, B.END, B.AMOUNT FROM TABLEA A LEFT JOIN TABLEB B ON A.ACCOUNT = B.ACCOUNT
Hello
SeshuGiri wrote:
Hi Frank,.
Your query/solution works very well, but I forgot to mention something in the first post...
Please insert these additional lines and try the request again.
TableA Additional lines:
- Insert into TABLEA (ACCOUNT, BEGIN, END, QUANTITY)
- values ('F9999', to_date (January 2, 2014 ',' dd-mm-yyyy ""), to_date (3 January 2014 ', 'dd-mm-yyyy'), 999.0000000000);
- Insert into TABLEA (ACCOUNT, BEGIN, END, QUANTITY)
- values ('A1234', to_date (March 3, 2014 ',' dd-mm-yyyy ""), to_date (4 March 2014 ', 'dd-mm-yyyy'), 999.0000000000);
TableB Additional lines:
- Insert into TABLEb (ACCOUNT, BEGIN, END, QUANTITY)
- values ('A1234', to_date (March 3, 2014 ',' dd-mm-yyyy ""), to_date (4 March 2014 ', 'dd-mm-yyyy'), 999.0000000000);
Question 1:
The table has a rows for A1234 account (i.e. the time period different than the ranks for the same account)
one is A1234 31/01/2014-03/03/2014, A1234 03/03/2014-03/04/2014
Your query that returns two rows for A1234 account (which is what I want), but the amount is messed up.
ACCOUNT BEGIN END TOTAL_AMOUNT 1 A1234 31/01/2014 03/03/2014 1100 2 A1234 03/03/2014 03/04/2014 1100 Except:
ACCOUNT BEGIN END TOTAL_AMOUNT 1 A1234 31/01/2014 03/03/2014 101 2 A1234 03/03/2014 03/04/2014 999 Question 2:
In some cases TableA will have an account (F9999), but the TableB don't. I can just this line by making the Left Join right join?
I don't get the results with additional data. I get 1099 for two lines where account = 'A1234 '. I get 1100 as the amount on the line with the account = "D5555. You did it other changes to data?
Except:
ACCOUNT BEGIN END TOTAL_AMOUNT 1 A1234 31/01/2014 03/03/2014 101 2 A1234 03/03/2014 03/04/2014 999 Still, I don't see why you want to 101 for the amount of the first row. Why not 100?
How can you know which rows from tablea should get attached to what rows from tableb, when the account is not unique?
Maybe you want something like this:
SELECT a.account
b.begin
b.end
SUM (a.amount) AS total_amount
FROM tablea a
ON a.account = b.account JOIN tableb B
AND a.begin BETWEEN b.begin
AND b.end
AND a.end BETWEEN b.begin
AND b.end
GROUP OF a.account, b.begin, b.end
ORDER BY a.account
;
but I guess just to your needs, and guessing is not a very good or reliable way to solve problems.
Question 2:
In some cases TableA will have an account (F9999), but the TableB don't. I can just this line by making the Left Join right join?
Yes, it looks that you want an outer join. What happened when you tried? As always, post your code, the exact results you want from the given sample data, as well as an explanation of how you get these results from these data.
-
How to get the date for the first Monday of each month
Dear members,
How to get the date for the first Monday of each month.
I wrote the following code
SELECT decode (to_char (trunc (sysdate + 30, 'MM'), 'DAY'), 'MONDAY', trunc (sysdate + 30, 'MM'), NEXT_DAY (trunc (sysdate + 30, 'MM'), "LUN")) FROM DUAL
But he looks at complex bith.
Abhishek
Published by: 9999999 on 8 March 2013 04:30Use the IW format - it will make independent NLS solution. And all you need is truncated 7th day of each month using IW:
select sysdate current_date, trunc(trunc(sysdate,'mm') + 6,'iw') first_monday_the_month from dual / CURRENT_D FIRST_MON --------- --------- 08-MAR-13 04-MAR-13 SQL>
Here is the list of the first Monday of the month of this year:
with t as( select add_months(date '2013-1-1',level-1) dt from dual connect by level <= 12 ) select dt first_of_the_month, trunc(dt + 6,'iw') first_monday_the_month from t / FIRST_OF_ FIRST_MON --------- --------- 01-JAN-13 07-JAN-13 01-FEB-13 04-FEB-13 01-MAR-13 04-MAR-13 01-APR-13 01-APR-13 01-MAY-13 06-MAY-13 01-JUN-13 03-JUN-13 01-JUL-13 01-JUL-13 01-AUG-13 05-AUG-13 01-SEP-13 02-SEP-13 01-OCT-13 07-OCT-13 01-NOV-13 04-NOV-13 FIRST_OF_ FIRST_MON --------- --------- 01-DEC-13 02-DEC-13 12 rows selected. SQL>
SY.
-
Get number of records in the date range - IDE: PLSQL Developer
I want to count the number of records of members who register within a date range specified, based on effective and expiration dates and their "elg_code". I posted the SQL code for some examples of data. What I would like to see returned is in three columns of the counties where the eff_date date_exp members fall within the date range specified by the SQL and have an Elg_code of ' ' (space).
So what I would like is all members with elg_code ' ' where he eff_dt and exp_dt range is April 2012, 2012 MAY & JUN 2012. Thus, according to data from the sample I posted, Mark, where his elg_code record is ' ', his eff_dt is 01/01/2011 and April 2012 (30/04/2012) is his exp_dt. Range of the brand statement may 2012, but not MAY or JUNE of 2012. Marty would tally for the APR and MAY because his eff_dt is before MAY 2012 and his exp to MAY 2012. etc...
According to the data below, the results should resemble:
APR MAY JUN
4-3-2
APR should have FRANK, MARK, MARTY, MARY.
MAY should have FRANK, MARTY, MARY
JUN should have FRANK and MARIE
NOAM and JOHN should not appear as his records with elg_code ' ' have no documents eff_dt and exp_dt which are April-June 2012.
So what I tried without success as it appears that I have a kind of Cartesian question (?), is:
Select count (m1.mbr_name) APR,
Count (m2.mbr_name) MAY,
Count (m3.mbr_name) JUN
mbr2 M1,
mbr2 m2,
mbr2 m3
"where m1.eff_dt < ' 01 - may - 2012"
"and m1.exp_dt > ' 01-Apr-2012.
and m1.elg_code = ' '
"and m2.eff_dt < 1 June 2012"
"and m2.exp_dt > ' 01 - may - 2012"
and m2.elg_code = ' '
"and m3.eff_dt < 1 July 2012"
"and m3.exp_dt > 1 June 2012"
and m3.elg_code = ' '
Here's the DML
Thanks for any help!
create table mbr2 (mbr_name varchar (10), varchar (1) grpid eff_dt date, date of exp_dt elg_code varchar (1))
Commit
insert into mbr2 values ('BRAND', 'A', to_date (January 1, 2011 ',' DD-MM-YYYY '), to_date (April 30, 2012 ',' DD-MM-YYYY '), ' ')
insert into mbr2 values ('BRAND', 'A', to_date (May 1, 2012 ',' DD-MM-YYYY '), to_date (31 December 2013 ',' DD-MM-YYYY '), 'C')
insert into mbr2 values ('MARTY', 'A', to_date (January 1, 2011 ',' DD-MM-YYYY '), to_date (May 31, 2012 ',' DD-MM-YYYY '), ' ')
insert into mbr2 values ('MARTY', 'A', to_date (June 1, 2012 ',' DD-MM-YYYY '), to_date (31 December 2013 ',' DD-MM-YYYY '), 'C')
insert into mbr2 values ('FRANK', 'B', to_date (January 1, 2011 ',' DD-MM-YYYY '), to_date (June 30, 2012 ',' DD-MM-YYYY '), ' ')
insert into mbr2 values ('FRANK', 'B', to_date (July 1, 2012 ',' DD-MM-YYYY '), to_date (31 December 2013 ',' DD-MM-YYYY ""), 'C')
insert into mbr2 values ('MARY', 'B', to_date (January 1, 2011 ',' DD-MM-YYYY '), to_date (June 30, 2012 ',' DD-MM-YYYY '), ' ')
insert into mbr2 values ('MARY', 'B', to_date (July 1, 2012 ',' DD-MM-YYYY '), to_date (31 December 2013 ',' DD-MM-YYYY ""), 'C')
insert into mbr2 values ('JOHN', 'C', to_date (January 1, 2011 ',' DD-MM-YYYY '), to_date (July 1, 2011 ',' DD-MM-YYYY '), ' ')
insert into mbr2 values ('JOHN', 'C', to_date (July 1, 2011 ',' DD-MM-YYYY '), to_date (1 January 2012 ',' DD-MM-YYYY ""), 'C')
insert into mbr2 values ("NOAM" 'd', to_date (July 1, 2012 ',' DD-MM-YYYY '), to_date (31 December 2013 ',' DD-MM-YYYY '), ' ' ")
CommitThis gives you a report for the current month and the two front. Column header must be adjusted ;-)
select count( case when eff_dt < add_months(trunc(sysdate,'MM'), -1) and exp_dt >= add_months(trunc(sysdate,'MM'), -2) then 1 end) April , count( case when eff_dt < add_months(trunc(sysdate,'MM'), 0) and exp_dt >= add_months(trunc(sysdate,'MM'), -1) then 1 end) May , count( case when eff_dt < add_months(trunc(sysdate,'MM'), 1) and exp_dt >= add_months(trunc(sysdate,'MM'), 0) then 1 end) June from mbr2 where elg_code = ' ' and eff_dt < add_months(trunc(sysdate,'MM'), 1) and exp_dt >= add_months(trunc(sysdate,'MM'), -2) APRIL MAY JUNE 4 3 2
-
Date field min, max attribute does not
Hi team,
I use in my application webworks, html date field. I want to control the date range of selection user with min and Max device attribute shows the native date picker after giving the input focus, but its does not not the given range.
Please suggest me how to do?
Kind regards
Ilhem
Thank you, it seems that the spec meets the min/max of what I could find.
I reported it to the WebWorks team.
-
How do I get the data in order by date
Hello
I get the data as below, I need the data with null values
Date col1 col2 col3 col4
16 November 11 23
November 17 11 12
18 November 11 321
19 November 11 23
20 November 11 132
2321 16 November 11
17 November 11 112
18 November 11 211
19 November 11 132
November 20, 11 12
16 November 11 45
17 November 11 465
2123 18 November 11
19 November 11 132
20 November 11 65
16 November 11 456
17 November 11 546
4656 November 18, 11
19 November 11 566
20 November 11 564
need output like below
Date col1 col2 col3 col4
16 November 11 23 2321 45 456
November 17 11 12 112 465 546
18 November 11 321 211 2123 4656
19 November 11 23 132 132 566
20 November 11 132 12 65 564
Thanks in advance,
Vincent.Delighted ADIK wrote:
Please post requests INSERT such as requested by another user of the forum. Also mention the version of Oracle.Please search for WM_CONCAT.
http://www.Oracle-base.com/articles/Misc/StringAggregationTechniques.php
Yes, search for WM_CONCAT, and then COMPLETELY IGNORE IT because it is not the right way to do things. It is undocumented and should not be used similarly recommended.
Even Tom Kyte says that you should not use it...
Re: SEPARATE does not not with wmsys.wm_concat
WM_CONCAT is also an aggregation of chain function, and is not what the OP's request.
Frank gave the good solution, as evidenced by...
SQL> ed Wrote file afiedt.buf 1 with t as (select to_date('16-Nov-11','DD-Mon-RR') as dt, 23 as col1, null as col2, null as col3, null as col4 from dual union 2 select to_date('17-Nov-11','DD-Mon-RR'), 12, null, null, null from dual union all 3 select to_date('18-Nov-11','DD-Mon-RR'), 321, null, null, null from dual union all 4 select to_date('19-Nov-11','DD-Mon-RR'), 23, null, null, null from dual union all 5 select to_date('20-Nov-11','DD-Mon-RR'), 132, null, null, null from dual union all 6 select to_date('16-Nov-11','DD-Mon-RR'), null, 2321, null, null from dual union all 7 select to_date('17-Nov-11','DD-Mon-RR'), null, 112, null, null from dual union all 8 select to_date('18-Nov-11','DD-Mon-RR'), null, 211, null, null from dual union all 9 select to_date('19-Nov-11','DD-Mon-RR'), null, 132, null, null from dual union all 10 select to_date('20-Nov-11','DD-Mon-RR'), null, 12, null, null from dual union all 11 select to_date('16-Nov-11','DD-Mon-RR'), null, null, 45, null from dual union all 12 select to_date('17-Nov-11','DD-Mon-RR'), null, null, 465, null from dual union all 13 select to_date('18-Nov-11','DD-Mon-RR'), null, null, 2123, null from dual union all 14 select to_date('19-Nov-11','DD-Mon-RR'), null, null, 132, null from dual union all 15 select to_date('20-Nov-11','DD-Mon-RR'), null, null, 65, null from dual union all 16 select to_date('16-Nov-11','DD-Mon-RR'), null, null, null, 456 from dual union all 17 select to_date('17-Nov-11','DD-Mon-RR'), null, null, null, 546 from dual union all 18 select to_date('18-Nov-11','DD-Mon-RR'), null, null, null, 4656 from dual union all 19 select to_date('19-Nov-11','DD-Mon-RR'), null, null, null, 566 from dual union all 20 select to_date('20-Nov-11','DD-Mon-RR'), null, null, null, 564 from dual) 21 -- 22 -- end of test data 23 -- 24 select dt 25 ,max(col1) as col1 26 ,max(col2) as col2 27 ,max(col3) as col3 28 ,max(col4) as col4 29 from t 30 group by dt 31* order by dt SQL> / DT COL1 COL2 COL3 COL4 ----------- ---------- ---------- ---------- ---------- 16-Nov-2011 23 2321 45 456 17-Nov-2011 12 112 465 546 18-Nov-2011 321 211 2123 4656 19-Nov-2011 23 132 132 566 20-Nov-2011 132 12 65 564 SQL>
-
On the date ranges in search of oracle forms
I use service number, name, type person and date as search criteria in the custom form ranges.
When I enter the employee number, press the search button, I get the exact info in the block of result.
Result block contains
name of the employee, personid, emp numbed, org, start_date.
Similarly when I enter the employee number, dept, I get the correct values.
My question is, when I enter the date range. IAM unable to filter the data.
When I enter START_DATE between nvl(:BLOCKNAME.) Start_date, 1 January 1901 ') and nvl(:BLOCKNAME.) End_date, 31-DEC-4712') where block clause in the result. I had data for the range of dates also.
If I give condition in where clause results take so long when I search with the name of the employee, number, dept, person type.
If I have a query with the date, the persormance is good.
Think you know everything, how it prevents START_DATE between nvl(:BLOCKNAME.) Start_date, 1 January 1901 ') and nvl(:BLOCKNAME.) End_date, 31-DEC-4712') when look us with the employee's name, number, dept, person type.So leave the WHERE clause of your empty block and put something like the following in your search button:
IF :BLOCK.START_DATE IS NOT NULL OR :BLOCK.END_DATE IS NOT NULL THEN SET_BLOCK_PROPERTY('YOURBLOCK', ONETIME_WHERE, 'START_DATE between nvl(:BLOCKNAME.START_DATE,TO_DATE(''01-JAN-1901'', ''DD-MON-YYYY'')) and nvl(:BLOCKNAME.END_DATE,TO_DATE(''31-DEC-4712'', ''DD-MON-YYYY''))'); END IF;
-
Move the data from Palm Z22 for palm M125
My Palm Z22 batteries do not hold a charge. I recently bought a Palm M125, but have been unable to transfer data from the Z22, the M125. My op system is Windows Vista Ultimate 32-bit Edition processor. Is it possible to move the data?
If the Z22 still works, the best way to transfer your data is for her beam to the M125. At least, for the PIM of Palm of basic data (e.g., calendar, Contacts, memos, to-(tasks)). On the Z22 in calendar, switch to the display of the day (not the order of the day). In the menu, select the category of beam, choose the date range and select all from the drop-down list category. Make sure that receiving IR is selected in the receiving device. Align them face to face on one foot out and tap the beam.
In Contacts, select the category in the upper right, then open the Menu and select the category of beam. Same process for tasks and memos.
Data and third-party applications might not let u their beam. In addition, you will a newer device a lot older with an older operating system that may not work new apps. So, after you transfer your PIM data, try beaming your third-party apps at a time to see if they run again. The Z22 Launcher screen (at home), open the Menu, and then select the beam. Highlight apps one at a time and try to beam at the M125. My guess is that apps like Documents To Go might not even run, if they let u beam, because they were written for the newer versions of Palm OS than what works the M125.
There is also an upgrade process where you can do this thru Palm Desktop when you switch devices. But again because once you go towards the back to an older device, there are some compatibility issues with the applications, databases and files of the system, not to mention the questions according to what version you use Palm Desktop.
Let us know if ensoupler works, or if you encounter any problems, in this case, we can go to the ugrade process. Also, let us know what version of Palm Desktop you will synchronize with.
-
How can I get the data view to display the same amount of time I save?
I use the Sound and Vibration Measurement Suite. In the data view, I display a graph of time, the power spectrum, the Color Map and the waterfall. I am also showing strength in numbers group for several bands and doing cutting-edge research. I record 100 ms of the transient wave. In the data view, why the temporal plots show several seconds of data? What determines how much time will appear in the data view? More important, the power spectrum reflects the power for the entire of several seconds of data displayed? Same question for power in the values of band and cutting-edge research. I want to just this data displayed for 100 ms of the wave that I record. So, how can I get the data displayed (waveforms) and power numbers come only 100 ms of the recorded wave?
Finally, what is the best way to make account concisely the recorded data? By slide numbers on the Documentation tab is not concise, because it comes with graphics, etc.. I tried save as ASCII/LVM, but I get a bunch of stuff intermiated I don't care. Help?
Hi TimRsandiego,
SignalExpress is programmed to display graphs with default scales based on the type of action, it's reading. These scales and settings can be changed by right-clicking on the graph, and then select Properties.
If you are interested to learn more about how to use SignalExpress, I would recommend checking out some demonstrations/tutorials on NI.com. You can find some of these demos at the following location:
Let me know if you have any other questions.
Kind regards
-
Used
Now cannot open encrypted files.When you try to pass the correct encryption certificate I get the error:
"Key not valid for use is specified state."It is as it's supposed to as an anti theft precautions. I mean that data is encrypted, if somebody stole your hard drive and the hard drive boots and the other account it can receive data.
If you not export recovery certificates and encrypting the data, you cannot redo the decryption.
http://Windows.Microsoft.com/en-us/Windows/back-up-EFS-certificate#1TC=Windows-7
If it's a default domain recovery agent. admin area. If it's home, to look for recovery certified you have exported.
But third-party tools are there if you can remember old password the is to encrypt you can recover. But they are not free... and premium software is not be recommended or guided through support free forum due to the effort of preventing unnecessary advertising.
You can do you own research about recovering data... just try to get you using the favorite search engine... "Restore access to encrypted EFS format files" or "Advanced EFS Data Recovery.
Many more free guides will be available... Just keep in mind this is not a method to escape... you must remember your old password at least for decryption in the case where you export a certificate.
-
Hello
I lost the password I gave to a drive using Bitlocker in Windows 7, how can I return it or I can get the data in the back of the player? Data are very important because by my studies are concerned. Help, please. Thank you!Hello
I lost the password I gave to a drive using Bitlocker in Windows 7, how can I return it or I can get the data in the back of the player? Data are very important because by my studies are concerned. Help, please. Thank you!People like you that encryption data with bitlocker do it because they want their data accessible only by those who have the certificate. The sad news for you is that you have made a good choice with BitLocker: unless you have the certificate, your data remains inaccessible. There is no backdoor. If he had then BitLocker would be useless. -
Get the data in table of javafx
Bat I can get the data in table as:
[code]
for (int i = 0; i < dtm.getRowCount (); i ++)
{
for (int j = 0; j < dtm.getColumnCount (); j ++)
dtm.getValueAt (i, j);
[/ code]
But how can I do this with javafx table? I google and google and google and no luck.
In JavaFX make data are stored on a basis per line. Each line contains an element of type T (where you have a TableView
), and each column specifies a value using a callback function that determines the value of the column of the value of a particular line. You can browse the data simply by practice
for (T item : table.getItems()) { // ... }
And then get the value of each column for each element of the given line, since you "know" what each column represents.
For example, in the example of JavaFX documentation, you could do:
for (Person person : table.getItems()) { String firstName = person.getFirstName(); // value in firstName column String lastName = person.getLastName(); // value in lastName column String email = person.getEmail(); // value in email column }
If you want something really generic, you can try
for (T item : table.getItems()) { for (TableColumn
col : table.getColumns()) { Callback , ObservableValue>> cellValueFactory = col.getCellValueFactory(); CellDataFeatures cdf = new CellDataFeatures (table, col, item); Object cellValue = cellValueFactory.call(cdf).get(); // do something with cellValue... } } If you have little chance to this need, unless you write some kind of framework. (I just typed it here, you may have get dirty you with guys a little to make things).
Maybe you are looking for
-
Pouvez individual emails to group TB that are connected through answers?
Is there a setting for the connection or group individual email who is a connected through answers. Outlook (used to work) has this feature and I really like it. Any new e-mail associated with the original is added to the title of the original, by el
-
"Extraction failure: cannot open output file" error message when installing new drivers
Hello, I am trying to install new drivers for my HP Photosmart C4385 printer. I downloaded the complete drivers of features for Windows XP 32-bit, and when I start to install (extract), I get the error message: Extraction failed Cannot open output f
-
Satellite Pro P100-438: how to disable the CapsLock NumLock or Scroll sounds
Hi out there,. How can I disable these "ugly" notification sounds when I press CapsLock NumLock or Scroll? It's a Satellite Pro P100-438. Does anyone have any suggestions? Thank you
-
Bad sound with my Satellite M40-230
I just bought my laptop M40-230 and when playing music the sound is very mediocre and bad. It is common, or there is a problem with my speakers?
-
HP Pavilion DV6500: upgrading the BIOS on HP DV6500 w/Win7-64
HP Pavilion DV6500 Service etiquette: dv6607rs Memory: 2 GB to 4 GB upgrade Operating system: Win7 Ultimate 64-bit HD: upgrading to the new Toshiba 1 TB HDD - MQ01ABD100 OLD HD: Western Digital WD1600BEVS - 60RST0 CPU: upgrading to AMD Turion64 X 2 T