First and last &; functions
HelloCan someone give me a brief description of the functions of first and last in sql. If you can explain with an example... It is very useful.
Concerning
AR
Hello
Check this box... Hope this will help you
First and Last:
***********
The FIRST and LAST functions can be used to return the first or last value from an ordered sequence. Say we want to display the salary of each employee, along with the lowest and highest within their department we may use something like:
SELECT deptno,
ename,
sal,
MIN(sal) KEEP (DENSE_RANK FIRST ORDER BY sal) OVER (PARTITION BY deptno) "Lowest",
MAX(sal) KEEP (DENSE_RANK LAST ORDER BY sal) OVER (PARTITION BY deptno) "Highest"
FROM emp
ORDER BY deptno, sal;
DEPTNO ENAME SAL Lowest Highest
---------- ---------- ---------- ---------- ----------
10 MILLER 1300 1300 5000
10 CLARK 2450 1300 5000
10 KING 5000 1300 5000
20 SMITH 800 800 3000
20 ADAMS 1100 800 3000
20 JONES 2975 800 3000
20 SCOTT 3000 800 3000
20 FORD 3000 800 3000
30 JAMES 950 950 2850
30 WARD 1250 950 2850
30 MARTIN 1250 950 2850
30 TURNER 1500 950 2850
30 ALLEN 1600 950 2850
30 BLAKE 2850 950 2850
KPR
Tags: Database
Similar Questions
-
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
-
I would like to change the name in my profile my name and my company name, so when my clients receive a signature on the Forms application, my company name is displayed in the email as opposed to my first and last name. How can I change this? I tried to edit my profile however my first and last name are not editable fields.
Hello Laurag92400722,
You connect with Adobe ID account E-Sign? If Yes, then you can directly connect to your Adobe ID account and can update the name as the name of the company and it will reflect in your E-Sign account as well.
-Usman
-
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
-
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.
-
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 select lines if a column has the same first and last characters?
Hello
I have a scenario that one of the columns in the table of the student is having names student, (Ex) John, Mary, Donald, Ana, Maria. In this case how can we write a query to retrieve lines for the values if the first and the last character of the student of identical names? Production is expected to be Donald, Ana.
Frank answers the question in the subject of your post, but looking at your examples, I think you wanted
WHERE lower (SUBSTR (student_name, 1, 1)) - 1 character
low = (SUBSTR (student_name,-1)) - last character
-
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
-
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
-
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;
?
-
Average of all values between (above first and last above) a threshold value.
Currently I have a VI where I programmed a year or more ago, takes any value of a set of data that exceeds a certain threshold. It is used to capture the average of all values above a threshold when there is a peak of the values that exceed this threshold. However, when there are two or more peaks that exceed this threshold, only values greater than this value are averaged, so the final result is the average of the two or more.
What I need is for each value that occurs after the threshold is reached, and before that the threshold fell below for the last time. Imagine a set of data whose graph looks like the letter "M" for example with the threshold being to halfway to the top of the
M, I want to show the average (the first bump, the fall below the bumps, as well as the last bump) but what I'm saying now is the average of (the first bump, over the last bump). What I get now cut the data between the two summits.Any help would be appreciated of course.
Here's a method, perhaps not the best.
-
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
-
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
-
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.
Maybe you are looking for
-
I just renewed my warranty for HP Pavilion all in one for 3 years, I received an e-mail telling me it would be actvated for me. But on the HP support assistant, he says I left 3 months of my original warranty? will this updated to show my new warran
-
EliteBook 8560p: fingerprint validity does not work in windows 10
Hi > My cell phone was on windows 8.1 and I used hp protect tools for log on to windows using my fingerprint I have installed windows 10 now and 10 windows asked me to uninstall hp protect tools because it is not compatible now in windows 10 > there
-
Graph XY no lines, just Points?
Hi all I want to build a graph of pressure relative to the temperature. It must be a standard XY graph, but I just want to see the scatter point without lines connecting the points. Is it possible to eliminate the lines between points (or make them
-
I need to improve my Home Windows Vista business on my gateway to work from home. One of my friends has a reinstallation of Windows Vista Business from DELL DVD. I'd be able to simply insert the DELL Vista Business DVD in my gateway and be good, or
-
Missing "run as" option of context solely on 'limited' user accounts
Like "admin", my context menu lists "run as". In my (limited) internet accounts, 'run as' does not appear in the context menu. I wouldn't be on the internet while being logged in as "admin" for security reasons. I ran Shell Menu View (NirSoft) and ev