Calculate the date of the first or last in a quarter
HelloI have data of project with a start date and end date I need to calculate the number of days per quarter
project x: 15/03/06 - 15/05/06
15 days Q1 = Q2 = 45 days
I'm then going to calculate the percentages of resource. I can get the bt of the watch with a hack of a time to identify the first or the last day of a given quarter. Any help win my sincere admiration.
Sorry, misread the question. The district will rely on the company that you work for. If the end of his is the same as an end of year calendar (31 December), then the example below will be accurate. Change the dates according to the needs of the company.
You can hardcode the variables in your application.cfm page.
quarter1start = "01 - jan -";
quarter2start = '01 - apr -';
quarter3start = "01 - jul -";
quarter4start = '01 - oct -';
Programatically, the end of each quarter is always the day before the start of the next quarter.
I would add "year" to the equation dynamically, to keep in it before compatible.
Tags: ColdFusion
Similar Questions
-
Need a query to return the first and last date for a rowset.
Hello
I have a query which can be simplified to the following data, if
Assume that it is my dataset, with THE_VALUE of
Sign (Anum) therefore,-1, 0 or 1.
* (Sorry for crushed registration. "I can't understand this website's rich text formatting.) *
THE_VALUE THE_DATE THE_MEMBER
1 0 1 January 2007
1 0 1 February 2007
1 0 1 March 2007
1. 1 April 1, 2007
1 1 1 May 2007
1 0 1 June 2007
1. 1 July 1, 2007
1. 1 August 1, 2007
1 0 01 - sep - 2007
2 0 1 January 2007
2 1 February 1, 2007
2 0 1 March 2007
2. 1 April 1, 2007
2 1 1 May 2007
2 0 1 June 2007
-2 1 1 July 2007
2. 1 August 1, 2007
2. 1 01-sep-2007
3 0 1 January 2007
3. 1 February 1, 2007
3 0 1 March 2007
3 0 1 April 2007
3. 1 May 1, 2007
3 0 1 June 2007
3. 1 July 1, 2007
3. 1 August 1, 2007
3 0 01 - sep - 2007
I need to get the lines with the THE_MEMBER, the values of the first and the last
THE_DATE, where the value is - 1, and the date range is the last
set of lines to the Member, with the same value of THE_VALUE.
I tried the following to get the dates of first and last for a set
consecutive months with the same value for the Member.
SELECT the_member
the_value
the_date
first_value (the_date)
in the first_date (PARTITION the_member, ORDER BY the_member the_value, the_date)
last_value (the_date)
during the last_date (PARTITION the_member, ORDER BY the_member the_value, the_date)
OF togola
ORDER BY the_member
the_date;
At first, it seems to work, but then, when the return value
an old value, FIRST_DATE will be the first of all the lines containing
This value for the Member rather than the first of consecutive
rows with this value for the Member. Apparently the partitioning
occurs before the order.
THE_MEMBER THE_VALUE THE_DATE FIRST DATE LAST DATE
1 0 January 1, 2007 January 1, 2007 January 1, 2007
1 0 1 February 2007 1 January 2007 1 February 2007
1 0 1 March 2007 1 January 2007 March 1, 2007
1. 1 April 1, 2007 April 1, 2007 April 1, 2007
1. 1 May 1, 2007 April 1, 2007 may 1, 2007
1-0 June 1, 2007 January 1, 2007 June 1, 2007
1. 1 July 1, 2007 April 1, 2007 July 1, 2007
1. 1 August 1, 2007 April 1, 2007 August 1, 2007
1 0 01 - sep - 2007 1 January 2007 01-Sep-2007
2 0 January 1, 2007 January 1, 2007 January 1, 2007
2 1 1 February 2007 February 1, 2007 February 1, 2007
2 0 1 March 2007 1 January 2007 March 1, 2007
2. 1 April 1, 2007 February 1, 2007 April 1, 2007
2 1 1 May 2007 February 1, 2007 may 1, 2007
2-0 June 1, 2007 January 1, 2007 June 1, 2007
-2 1 1 July 2007 February 1, 2007 July 1, 2007
2. 1 August 1, 2007 February 1, 2007 August 1, 2007
2. 1 01-sep-2007 1 February 2007 01-Sep-2007
3 0 January 1, 2007 January 1, 2007 January 1, 2007
3. 1 February 1, 2007 February 1, 2007 February 1, 2007
3 0 1 March 2007 1 January 2007 March 1, 2007
3 0 April 1, 2007 January 1, 2007 April 1, 2007
3. 1 May 1, 2007 February 1, 2007 may 1, 2007
3 0 June 1, 2007 January 1, 2007 June 1, 2007
3. 1 July 1, 2007 February 1, 2007 July 1, 2007
3. 1 August 1, 2007 February 1, 2007 August 1, 2007
3 0 01 - sep - 2007 1 January 2007 01-Sep-2007
That's what I need to get in the end.
THE_MEMBER FIRST DAY DATE OF LAST
July 2 1 2007-01 - Sep - 2007
Any ideas would be really appreciated.
Published by: user10700981 on December 17, 2008 13:57Hello
We'll call the lines whose the_value =-1 'good' lines and lines with the_value! =-1 ranks of 'bad '.
For each value of the_value, we need the first and last values of the_date where
the last row in the group is good
(b) the current line is good
(c) there is a lot of lines from the current line to the end of the Group
Condition (a) is just a special case of (c).
Conditions (b) and (c) are similar: (b) if applied to the current line, (c) applies to all lines after him. They can easily be combined into a single test that counts the number of lines after the current line or bad.Which produces the results you requested of the sample data that you provided:
WITH count_bad AS ( SELECT the_member , the_date , COUNT ( CASE WHEN the_value != -1 -- assuming the_value is never NULL THEN 1 END ) OVER ( PARTITION BY the_member ORDER BY the_date DESC ) AS bad_cnt FROM table_x ) SELECT the_member , MIN (the_date) AS first_date , MAX (the_date) AS last_date FROM count_bad WHERE bad_cnt = 0 GROUP BY the_member ORDER BY the_member;
-
How to calculate the first day of the month following in BI Publisher
I need to be able to calculate the first day of the month of a date field in a BI Publisher model. The field name is COL_CLM_180 and contains a date in the format "YYYY-MM-DD". I have found so far any documentation that still gives me an idea of what to do.
Any help or advice would be appreciated
Hi - thank you very much for your help. Your last answer got me going in the right direction and I indeed was dense. I don't know why I don't think to the calculation in the original query. I put the statement: TRUNC (ADD_MONTHS(A.COL_CLM_180,1), 'MM') in a column in the query of conduct and it has worked flawlessly. Thank you - thank you - thank you.
-
Detect the first and last spark of list items
Hello
I have a converter item personalized with a background image for each item in a list. the thing is I'm trying to have a different background for the first and last elements (curved respectively) and I don't know how to do this.
Any help will be appreciated.
not sure it's the best solution, but:
You can override the method to data defined in your itemRenderer. Compare the new data for the first and last items in your list. And you set the background depending on the result.
-
Impossible to print the first and last pages of a pdf of the 8 page?
I have a pdf of 8 pages exported from an InDesign document. I can print it without any problem on my MAC, but when I will forward it to a partner, she is unable to print the first and last pages. Any ideas?
Could you please let us know the version of Adobe Reader is installed on the machine?
What operating system is installed on the machine-Windows/Mac?
The pdf is printing via a network printer?
This phenomenon happens with a specific document only or with other documents as well?
Try to print the pdf as image, launch Adobe Reader, click Print > select your printer from the drop-down > click on advanced > check the print as Image > and then click OK.
Let us know if it worked.
Thank you
Shivam
-
Hi, when you cut a clip using the standard cursor (not the adjustment tool but just the mouse), the behavior that I was accustomed to is it shows the first and last frame of the clip you're carved, in a 2 - up window. Now in the updated 2015 I'm confused because it's still place 2 window, but instead I see the head or tail of any clip is next to any side of the clip, I'm trying to cut. I can see the utility in this, but I would like to know where I can go to the screen more as I'm used to it...
Thank you!
Click on the key in the timeline and in the drop-down the menu uncheck Composite overview over the filling.
MtD
-
Can only see the first and last frame of the item in the editing HELP PLEASE
Hi, my first time and I find an answer, but fails. I first elements 4 and I'm trying to worm. 9. in version 4 clips in the timelin shows all the frames, but in ver 9 it only shows the first and last frame clips. Is it possible to make all the images to display. I mean by "all frames", clips from filling with frames. I wanted to see all of the images in the scenario, it is easier for me to select and cut the pieces on.
My features are Core 2 Duo 6750, Nvidia 8600GTS, 4 G of Ram and Vista Home Premium. 3 HARD DRIVE 3 TB.
Thank you for having responded
Werner
Werner,
Welcome to the forum.
In the header of the video track, there is an icon for Clip thumbnail display. It's a cycle, and you can scroll through the Modes to display the first frame, first & last, all, or none (name of file only). In pre 4.0, it's on the far left in the header of the track. I guess that's about the same place in pre 9.0.
Good luck and hope that helps.
Hunt
-
Hello people:
I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.
Any help or pointers would be great!
Thank you!
Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).
The request in hand:
SELECT first_thursday + (7 * (LEVEL - 1)) AS week_start_date, first_thursday + (7 * LEVEL) - 1 AS week_end_date FROM ( SELECT TRUNC(p_from_date + 4, 'IW') - 4 AS first_thursday, -- Week should start the pre ceeding THURSDAY based on the Start Date TRUNC( p_to_date + 4, 'IW') - 5 AS last_wednesday FROM ( SELECT to_date('01-JAN-2013') AS p_from_date, NVL(to_date('31-DEC-2013'), SYSDATE) AS p_to_date FROM dual ) parms ) end_points CONNECT BY LEVEL <= ( last_wednesday + 1 - first_thursday)/7;
Currently, this is the result I get (I'm only including the months of January and December here).
Week_Start_Date Week_End_Date 27-DEC-12 02-JAN-13 03-JAN-13 09-JAN-13 10-JAN-13 16-JAN-13 17-JAN-13 23-JAN-13 24-JAN-13 30-JAN-13 31-JAN-13 06-FEB-13
December:
28-NOV-13 04-DEC-13 05-DEC-13 11-DEC-13 12-DEC-13 18-DEC-13 19-DEC-13 25-DEC-13
What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:
January:
01-JAN-13 02-JAN-13 03-JAN-13 09-JAN-13 10-JAN-13 16-JAN-13 17-JAN-13 23-JAN-13 24-JAN-13 30-JAN-13 31-JAN-13 31-JAN-13
February:
01-FEB-13 06-FEB-13 07-FEB-13 13-FEB-13 14-FEB-13 20-FEB-13 21-FEB-13 27-FEB-13 28-FEB-13 28-FEB-13
November:
31-OCT-13 06-NOV-13 07-NOV-13 13-NOV-13 14-NOV-13 20-NOV-13 21-NOV-13 27-NOV-13 28-NOV-13 04-DEC-13
December:
01-DEC-13 04-DEC-13 05-DEC-13 11-DEC-13 12-DEC-13 18-DEC-13 19-DEC-13 25-DEC-13 26-DEC-13 31-DEC-13
Hello
Roxyrollers wrote:
Hello people:
I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.
Any help or pointers would be great!
Thank you!
Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).
The request in hand:
- First_thursday SELECT + (7 * (LEVEL - 1)) AS week_start_date,
- first_thursday + (7 * LEVEL)-1 AS week_end_date
- Of
- (
- SELECT TRUNC (p_from_date + 4, 'IW') - 4 AS first_thursday,-week should start to perform the pre-mounted THURSDAY based on the Start Date
- TRUNC (p_to_date + 4, 'IW') - 5 AS last_wednesday
- Of
- (
- SELECT to_date('01-JAN-2013') AS p_from_date,
- NVL (to_date('31-Dec-2013'), SYSDATE) AS p_to_date
- OF the double
- ) parms
- ) end_points
- CONNECT BY LEVEL<= (="" last_wednesday="" +="" 1="" -="">=>
Currently, this is the result I get (I'm only including the months of January and December here).
- Week_Start_Date Week_End_Date
- DECEMBER 27, 12 2 JANUARY 13
- JANUARY 3, 13 JANUARY 9, 13
- 10 JANUARY 13 JANUARY 16, 13
- 17 JANUARY 13 23 JANUARY 13
- 24 JANUARY 13 30 JANUARY 13
- 31 JANUARY 13 FEBRUARY 6, 13
December:
- NOVEMBER 28, 13 4 DECEMBER 13
- 5 DECEMBER 13 DECEMBER 11, 13
- 12 DECEMBER 13 18 DECEMBER 13
- 19 DECEMBER 13 DECEMBER 25, 13
What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:
January:
- JANUARY 1, 13 2 JANUARY 13
- JANUARY 3, 13 JANUARY 9, 13
- 10 JANUARY 13 JANUARY 16, 13
- 17 JANUARY 13 23 JANUARY 13
- 24 JANUARY 13 30 JANUARY 13
- 31 JANUARY 13 JANUARY 31, 13
February:
- 1ST FEBRUARY 13 FEBRUARY 6, 13
- 7 FEBRUARY 13 FEBRUARY 13, 13
- 14 FEBRUARY 13 FEBRUARY 20, 13
- 21 FEBRUARY 13 FEBRUARY 27, 13
- 28 FEBRUARY 13 FEBRUARY 28, 13
November:
- 31 OCTOBER 13 NOVEMBER 6, 13
- 7 NOVEMBER 13 NOVEMBER 13, 13
- 14 NOVEMBER 13 NOVEMBER 20, 13
- 21 NOVEMBER 13 NOVEMBER 27, 13
- NOVEMBER 28, 13 4 DECEMBER 13
December:
- 1ST DECEMBER 13 DECEMBER 4, 13
- 5 DECEMBER 13 DECEMBER 11, 13
- 12 DECEMBER 13 18 DECEMBER 13
- 19 DECEMBER 13 DECEMBER 25, 13
- 26 DECEMBER 13 DECEMBER 31, 13
Why the "weeks" in November, have all 7 days, while the "weeks" in the first or the last week in the other month usually have less? (For example, February 28 is a 'week' alone.)
The following works for the other months:
WITH all_days AS
(
SELECT DATE "2013-01-01' + LEVEL - AS a_date 1
OF the double
CONNECT BY LEVEL<=>=>
)
SELECT DISTINCT
More GRAND (TRUNC (a_date + 4, 'IW') - 4)
, TRUNC (a_date, 'MONTH')
) AS week_begin
, The LEAST (TRUNC (a_date + 4, 'IW') + 2
TRUNC (LAST_DAY (a_date))
), Week_end
Of all_days
ORDER BY week_begin
;
Output:
WEEK_BEGIN WEEK_END
----------- -----------
January 1, 2013 January 2, 2013
January 3, 2013 January 9, 2013
January 10, 2013 January 16, 2013
January 17, 2013 January 23, 2013
January 24, 2013 January 30, 2013
January 31, 2013 January 31, 2013
February 1, 2013 February 6, 2013
February 7, 2013 February 13, 2013
February 14, 2013 February 20, 2013
February 21, 2013 February 27, 2013
February 28, 2013 February 28, 2013
...
November 1, 2013 November 6, 2013
November 7, 2013 November 13, 2013
November 14, 2013 November 20, 2013
November 21, 2013 November 27, 2013
November 28, 2013 November 30, 2013
December 1, 2013 December 4, 2013
December 5, 2013 December 11, 2013
December 12, 2013 December 18, 2013
December 19, 2013 December 25, 2013
26 December 2013 31 December 2013
-
To display the first and last date of one month
I have the date format in 10 Mar 10.
My requirement is when ever I select the date in the dashboard for all the month it should show results of all the months.
I had the request for obiee101.blogspot.com.but if I use that sometimes it is not the latest results of the day. Any body please give me the query to display the results for the first day and lastday?
I select any day from the drop-down menu of the guest, it must display the month of ex: if results
If I select either 1 mar mar 10.2 10,30 mar 10...
It should give results for the month of March.
Can you please provide me the query for the last month also?
If I select March date date print want to display the results of March together in a single column, results of the previous months in the other column
Someone help me to achieve this?Yes, you are right. Jean SQL for the last day of the month, if the "last day of the previous month" ends on June 30, that "adding a month" will result in the 30th of the following month. But if the next month has 31 days, you don't miss this day here.
Use it for the last day of the current month.
TIMESTAMPADD (SQL_TSI_DAY-1, TIMESTAMPADD (SQL_TSI_MONTH, 1, TIMESTAMPADD (SQL_TSI_DAY, 1, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (CURRENT_DATE) *-1, CURRENT_DATE))))
The SQL above will ensure that you will get always the last day of the month "current" no matter how many days during the previous or current month.
-
Find the first and last record in a game and the calculation of time
I have the following table and data below,
CREATE TABLE AAA_CDR
(ACCTTYPE (1) NUMBER, MSID VARCHAR2(20 BYTE), ACCOUNTSESSION_ID VARCHAR2(64 BYTE), BEGINNINGSESSION NUMBER (1),)
SESSIONCONTINUE NUMBER (1), ACCT_MULTI_SESSION_ID VARCHAR2(64 BYTE), DATAOCTETCOUNTORIGINATING NUMBER (20), DATAOCTETCOUNTTERMINATING NUMBER (20), ACCTSESSIONTIME NUMBER (20));
-SQL statement that produces these data:
/ * Select msid, accountsession_id, beginningsession, sessioncontinue, ACCTTYPE, acct_multi_session_id,.
dataoctetcountoriginating, dataoctetcountterminating, acctsessiontime
OF AAA_CDR
where msid = "5C4CA98EAC4C."
ORDER BY acct_multi_session_id, accountsession_id, accttype
*/
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (1, '5C4CA98EAC4C', '190001E9', 1, 0, '100014E19775F169', 0, 0, 0);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (2, '5C4CA98EAC4C', '190001E9', 0, 0, '100014E19775F169', 47496, 182054, 70);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (1, '5C4CA98EAC4C', ' 290001C 4', 1, 0, '100014E19E21F16C', 0, 0, 0);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (2, '5C4CA98EAC4C', ' 290001C 4', 0, 0, '100014E19E21F16C', 3278162, 17540714, 14152);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (1, '5C4CA98EAC4C', 190001 FC', 1, 0, '100014E1A949316E', 0, 0, 0);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (2, '5C4CA98EAC4C', 190001 FC', 0, 1, "100014E1A949316E", 682734, 2935111, 1553);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (1, '5C4CA98EAC4C', '190001FD', 0, 0, '100014E1A949316E', 0, 0, 0);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (2, '5C4CA98EAC4C', '190001FD', 0, 1, "100014E1A949316E", 1821052, 9585090, 5368);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (1, '5C4CA98EAC4C', '190001FE', 0, 0, '100014E1A949316E', 0, 0, 0);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (2, '5C4CA98EAC4C', '190001FE', 0, 1, "100014E1A949316E", 42012, 505004, 213);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (1, '5C4CA98EAC4C', '19000200', 0, 0, '100014E1A949316E', 0, 0, 0);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (2, '5C4CA98EAC4C', 0, '19000200', 1, '100014E1A949316E', 50224, 144566, 729).
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (1, '5C4CA98EAC4C', '19000201', 0, 0, '100014E1A949316E', 0, 0, 0);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (2, '5C4CA98EAC4C', 0, '19000201', 1, '100014E1A949316E', 62634, 378416, 392);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (1, '5C4CA98EAC4C', '19000202', 0, 0, '100014E1A949316E', 0, 0, 0);
Insert into AAA_CDR (ACCTTYPE, MSID, ACCOUNTSESSION_ID, BEGINNINGSESSION, SESSIONCONTINUE, ACCT_MULTI_SESSION_ID, DATAOCTETCOUNTORIGINATING, DATAOCTETCOUNTTERMINATING, ACCTSESSIONTIME)
Values (2, '5C4CA98EAC4C', '19000202', 0, 0, '100014E1A949316E', 1457286, 9141033, 7574);
commit;
I need to calculate the sum (dataeoctetcountoriginating) + sum (dataoctetcountterminating) for each session
It is average, but the beginning of the session and the end of the session, as below,
for each ACCT_MULTI_SESSION_ID and MSID
the beginning of the session is when the accttype = 1 and beginningsession = 1
and the end of the session is at this time the accttype = 2 and SESSIONCONTINUE = 0
1. collect the first accounting start CDR generated an event online for a user.
Collect CDR AcctType is 1 and beginning of Session is 1 according to MSID. In
also, see the value of the Acct-Multi-Session-ID field in the CDR.
2. collect all Accountants stop CDRs generated during this event the user online.
Collect CDR AcctType is 2 according to MSID and Acct-Multi-Session-ID.
If the value of Session continues on a CD - r accounting stop is 0, it indicates that this CDR
is the last CDR of accounting judgment that is generated during the event of the user's offline.
3. calculate the total volume of the user during this event online.
Add the values of the data fields Byte Count (termination) and data values
Fields byte (native) Count in the accounts collected stop CDRs together to get
the total volume of this event the user online.
How can I find each session, then calculate the sum of this session?
any help please
Published by: user11309581 on July 13, 2011 22:01Is that what you are looking for:
select acct_multi_session_id, max(ACCTSESSIONTIME)-min(ACCTSESSIONTIME) from AAA_CDR group by acct_multi_session_id
According to the DDL and DML you provided, this is the output I see:
ACCT_MULTI_SESSION_ID,MAX(ACCTSESSIONTIME)-MIN(ACCTSESSIONTIME) 100014E19E21F16C, 14152 100014E19775F169, 70 100014E1A949316E, 7574
-
Select the first or last row of sql Command
Hello
I am trying to get the fist or the last line of output from sql below
SQL> set head off; SQL> select r.actual_start_date,r.phase_code,r.status_code,r.actual_completion_date from 2 apps.fnd_concurrent_programs_vl p, apps.fnd_concurrent_requests r where p.concurrent_program_id = r.concurrent_program_id 3 4 and p.application_id = r.program_application_id 5 and p.user_concurrent_program_name like 'Purge Concurrent Request and/or Manager Data' 6 and r.actual_start_date >= sysdate-7 --and rownum<1 7 8 --order by r.requested_start_date 9 ORDER BY r.actual_completion_date DESC; 29-DEC-13 C C 29-DEC-13 28-DEC-13 C C 28-DEC-13 27-DEC-13 C C 27-DEC-13 26-DEC-13 C C 26-DEC-13 25-DEC-13 C C 25-DEC-13 24-DEC-13 C C 24-DEC-13 23-DEC-13 C C 23-DEC-13 7 rows selected. SQL> select r.actual_start_date,r.phase_code,r.status_code,r.actual_completion_date from 2 apps.fnd_concurrent_programs_vl p, apps.fnd_concurrent_requests r where p.concurrent_program_id = r.concurrent_program_id 3 4 and p.application_id = r.program_application_id 5 and p.user_concurrent_program_name like 'Purge Concurrent Request and/or Manager Data' 6 and r.actual_start_date >= sysdate-7 7 and rownum<2 8 --order by r.requested_start_date 9 ORDER BY r.actual_completion_date DESC; 27-DEC-13 C C 27-DEC-13 SQL> select r.actual_start_date,r.phase_code,r.status_code,r.actual_completion_date from 2 apps.fnd_concurrent_programs_vl p, apps.fnd_concurrent_requests r where p.concurrent_program_id = r.concurrent_program_id 3 4 and p.application_id = r.program_application_id 5 and p.user_concurrent_program_name like 'Purge Concurrent Request and/or Manager Data' 6 and r.actual_start_date >= sysdate-7 7 and rownum<1 8 --order by r.requested_start_date 9 ORDER BY r.actual_completion_date DESC; no rows selected SQL>
I want to get the last run of the program which is the first line of the top of the output of sql. (which is December 29, 13, first row on top of the exit)
But if I use the condition as ' where rownum < 1, its not giving any output, if I use where rownum < 2, if you do not have out. "
Grateful if someone can help.
-Thank you
Vijay...
Hi Vijay,
The following should work...
ROWNUM< 1="" will="" not="" retrieve="" any="" rows="" as="" rownum="" values="" start="" with="" 1.="" to="" get="" the="" desired="" result="" you="" have="" to="" build="" the="" result="" set,="" order="" it="" and="" then="" select="" the="" desired="">
SELECT *.
Of
(SELECT r.actual_start_date,
r.phase_code,
r.status_code,
r.actual_completion_date
Apps.fnd_concurrent_programs_vl p,
Apps.FND_CONCURRENT_REQUESTS r
WHERE p.concurrent_program_id = r.concurrent_program_id
AND p.application_id = r.program_application_id
AND p.user_concurrent_program_name LIKE 'Serve concurrent demand and/or Manager Data'
AND r.actual_start_date > = sysdate-7
-Order of r.requested_start_date
ORDER BY r.actual_completion_date DESC
)
WHERE rownum< 2="">
I hope this helps.
VR,
Sudhakar
-
How to get the first and last record
Hai All
I have a table called T1 and there are more than 8 lakhs Archives and I have a column named Timestamp, so I need to get the first record value and time stampvalue and last record and time stamp value so that I can conclude that for example
form June 13 to 15 June data are here
Kind regards
SrikkanthMWhat is the problem with:
select min(timestamp),max(timestamp) from T1;
?
-
Animate the first and last character
Hello
Does anyone have a model may be the way to animate the first and the last character or a tutorial?
For example, I would like to animate "ABCDEFG".
AG would be the first thing you see on the screen, then the distance between AG grew and fade the letters in the middle.
So, the result would be:
1 frame: AG
2: A G
3: ABG
4: ABCG
etc.
http://www.Mylenium.de/_temp/Text_Expand_00.zip
Mylenium
-
InDesign - prevent breaks between the first and last names in a very long list of names?
Is there a quick way to do? Having the list 800 names in a text box and want to prevent the first & last names being split at the end of the line. Other than choosing each name and apply the rule "no break" (a lot of time). Any other suggestions?
This is a more elegant solution:
(?<=[\l\u]) (?="">=[\l\u])>
Apply style: no pause
It detects all single space between two letters
-
calculate the difference in last hour?
Hi all
I have a sql like query below...
SELECT sn.snap_time, st.value
OF PERFSTAT. STATS$ SYSSTAT st, PERFSTAT. STATS$ SNAPSHOT sn
WHERE st.snap_id = sn.snap_id
and st.NAME = "user request".
and sn.snap_time > to_date (March 1, 2011 10:00 ',' mm/dd/yyyy hh24:ss:mi "")
order by 1 desc
and output is inferior to...
SNAP_TIME VALUE
-------------------- ----------
DECEMBER 19, 11 08:0:00 123501120
19 DECEMBER 11 07:0:00 121336929
DECEMBER 19, 11 06:0:01 119910473
DECEMBER 19, 11 05:0:01 118900726
DECEMBER 19, 11 04:0:07 118244503
DECEMBER 19, 11 03:0:01 117202971
DECEMBER 19, 11 02:0:01 115791474
DECEMBER 19, 11 01:0:03 114008304
19 DECEMBER 11 00:0:02 111347506
18 DEC 11 23:0:01 108291559
DECEMBER 18, 11 22:0:02 104340139
18 DEC 11 21:0:01 99255636
18 DEC 11 20:0:02 92775319
DECEMBER 18, 11 19:0:01 85262323
DECEMBER 18, 11 18:0:01 76262794
DECEMBER 18, 11 17:0:01 68381704
DECEMBER 18, 11 16:0:01 60100822
DECEMBER 18, 11 15:0:01 51855773
18 DEC 11 14:43733973 0:01
DECEMBER 18, 11 13:0:01 35903397
DECEMBER 18, 11 12:0:01 28494465
18 DECEMBER 11 11:0:01 21724443
DECEMBER 18, 11 10:0:02 15667617
DECEMBER 18, 11 09:0:01 10526163
DECEMBER 18, 11 08:0:01 6741565
18 DECEMBER 11 07:0:00 3622640
DECEMBER 18, 11 06:0:01 1623214
DECEMBER 18, 11 05:0:03 207054
But how can I write my query in a way if I can get the real value/difference of time before
.. all the above value is cumulative and I want to calculate the value of the actual hours... lets say from
DECEMBER 18, 11 05:0:03...
He hopes to make sense... I'm on 9.2.0.5Hello
To show the difference from the previous row (where "previous" is based on snap_time, ASCendcing order):
SELECT sn.snap_time , st.value , st.value - LAG (st.value) OVER (ORDER BY snap_time) AS value_change FROM PERFSTAT.STATS$SYSSTAT st , PERFSTAT.STATS$SNAPSHOT sn WHERE st.snap_id = sn.snap_id AND st.NAME = 'user calls' AND sn.snap_time > TO_DATE ( '03/01/2011 10:00:00' , 'mm/dd/yyyy hh24:ss:mi' ) ORDER BY snap_time DESC ;
In yopur sample data, it seems that each row is about an hour from its neighbours. If you missed an hour, or if you sometimes had two (or more) line in the same time, what wouold results you want? Post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all the tables and also post the results desired from these data.
Maybe you are looking for
-
Trouble installing the Readiris scanning software
I bought a new HP Officejet Pro 8715 and I had great difficulty it is set up to use. I am close to return to the store, except that the problem seems to be with Apple not with HP (or so I thought). It seems the method to print and scan drivers has ch
-
Problem starting Satellite M40 - windows didn't start up properly
Satellite M40 running XP Home, an 80 GB HD, 2 partitions, (System on C:, data on D :) During bootup, current sector has been disconnected (no battery in the laptop). When I try to start it again, go to the screen (sorry for the "mixed-language french
-
2013 Runtime will run 2009 applications?
I installed the Runtime 2013 (32 bit) and tried to launch an application 2009 (32-bit) (double click on the app). It did not work. Are not engines not backward compatible? Thank you Jeff
-
will there be new games of lips or the dlc?
I have speny of hundreds on a collection which now collects dust. News please
-
Hello, I started editing video on my Mac OS x 10.6 in I-movies. I am told that I need a certain application to create movies in MP4 on Mac format. Someone knows what to do? In addition, how to convert to FLV? Thanks VM. Sonia