Calculation for each 3 discs
I'm under the table with 10000 linesfor example, I added only 10 lines
I need fill the value r square for each (Column) has 3 rows and so on
Select * from TABLEAA
AN AVERAGE OF END TEACHER BEG
--------------------------------------------
1 0 0.1 159 159
2 0.1 0.2 159 168
3 0.2 0.3 179 159
4 0.1 0.2 250 300
5 0.2 0.3 320 250
6 0.3 0.4 250 380
7 0.2 0.3 388 379
8 0.3 0.4 379 388
9 0.4 0.5 388 400
10 1.5 0.6 499 500
R - square-> REGR_R2 (AVERAGE, TEACHER)
A BEGINNING TEACHER AVERAGE R_Square END
-------------------------------------------------
1 0 0.1 159 159
2 0.1 0.2 159 168
3 0.3 0.2 179 159 0.25
4 0.1 0.2 250 300
5 0.2 0.3 320 250
6 0.4 0.3 250 380 0.627906977
7 0.2 0.3 388 379
8 0.3 0.4 379 389
9 0.5 0.4 388 400 0.000755287
10 1.5 0.6 499 500
create table TABLEAA
(
A NUMBER,
PLEASE THE NUMBER,
NUMBER OF END,
NUMBER OF TEACHER,
AVERAGE NUMBER
)
;
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (10, 1.5,.6,, 499, 500);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (1, 0,.1, 159, 159);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (2,.1,.2,, 159, 168);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (3,.2,.3, 179, 159);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (4,.1,.2, 250, 300);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (5,.2,.3, 320, 250);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (6,.3,.4,, 250, 380);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (7,.2,.3, 388, 379);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (8,.3,.4,, 379, 388);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (9,.4,.5, 388, 400);
commit;
Thanks in advance
Published by: user1849 on August 19, 2009 09:48
First of all, thanks for providing the table create and inserts.
There is a function analytical regr_r2 who can do for you: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions132.htm#i85922. Note that I had to change the average value of 388 to 389 A = 8 online to get exact numbers.
SQL> select a
2 , beg
3 , end
4 , prof
5 , average
6 , case mod(a,3) when 0 then regr_r2(average,prof) over (order by a rows between 2 preceding and current row) end r_square
7 from tableaa
8 /
A BEG END PROF AVERAGE R_SQUARE
---------- ---------- ---------- ---------- ---------- ----------
1 0 ,1 159 159
2 ,1 ,2 159 168
3 ,2 ,3 179 159 ,25
4 ,1 ,2 250 300
5 ,2 ,3 320 250
6 ,3 ,4 250 380 ,627906977
7 ,2 ,3 388 379
8 ,3 ,4 379 389
9 ,4 ,5 388 400 ,000755287
10 1,5 ,6 499 500
10 rijen zijn geselecteerd.
Kind regards
Rob.
Tags: Database
Similar Questions
-
Change the label after you check the sum of calculation for the column
Hi all
I have a crosstab report and I checked the 'sum of calculation' for each column and the total at the bottom. The label is 'full report '. How to change this label?
Thanks in advance!On the attributes page of the report, in the region to break the formatting, you can put your text into the field "Display this text when printing of money to report".
-
Calculation for table element, then replace in same table
I have a 2D, c [j, i] table, and I want to perform calculations on each element of this array, c [j, I] = c [j, I] + d * one update [i], so that the same table with the new values. I installed the structure using a loop and got back each new c [j, I] that I'm supposed to do, but I can't seem to get these new values into the table. I tried to use the node 'Replace table subset' but I can't seem to connect the output to the same HP. array [j, I] table.
Any help is greatly appreciated!
Hi cmersit,
Why do you need that for? You have not said before...
Well, create a local to c [j, I], move it to the for loop and connect with the release of ReplaceArraySubset. It's going to hurt needs memory and processing speed and doesn't help here. Replace [result] with a local of c [j, I] for this example. Otherwise use a shift register in the outer loop!
-
Calculated for absent complex the day of the week
I need to find the number of days absent per employee according to the following criteria. I'll explain using test table as below.
the table below contains the data for each employee per day in the pt_hrs column, if the hours = 0 means that it is not present for that particular day. Friday is a weekend for us.
case 1,
Normal case since it is present every day except Friday, there are no missing for him.
Case 2,
If the employee is absent from Thursday and he reported to duty Saturday, then Friday is considered to be absent.
Case 3,
If the employee comes back from vacation let tell it the spokesperson of service directly on Saturday, and then Friday is considered to be absent.
Case 4
If the employee is absent from Thursday and he reported to duty Sunday, then Friday is considered to be absent.
[code]
CREATE TABLE PT_ATTENDANCE_REG (PT_EMP_CODE VARCHAR2 (12), PT_DATE DATE, NUMBER OF PT_HRS);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('24/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('25/11/2015'), 7);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('26/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('27/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('28/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('29/11/2015'), 8);
-case 2
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('24/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('25/11/2015'), 7);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('26/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('27/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('28/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R002', TO_DATE('29/11/2015'), 8);
-case3
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('24/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('25/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('26/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('27/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('28/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R003', TO_DATE('29/11/2015'), 8);
-CASE4
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('24/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('25/11/2015'), 7);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('26/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('27/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('28/11/2015'), 0);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R004', TO_DATE('29/11/2015'), 8);
-desired output will be as follows - R001 is not included because he was away for the weekend only.
PT_EMP_CODE, NO_OF_DAYS_ABSENT
'R002' 2
'R003' 4
'R004' 3
[/ code]
Hello
Arif75 wrote:
...
CREATE TABLE PT_ATTENDANCE_REG (PT_EMP_CODE VARCHAR2 (12), PT_DATE DATE, NUMBER OF PT_HRS);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('24/11/2015'), 8);
INSERT INTO PT_ATTENDANCE_REG (PT_EMP_CODE, PT_DATE, PT_HRS) VALUES ('R001', TO_DATE('25/11/2015'), 7);
,,,
Thanks for posting of sample data, but always use 2 arguments when calling TO_DATE. The TO_DATE call with 1 single argument has all the problems of an implicit conversion.
Thus, a person is considered on Friday that if he was absent the day before or the day after, isn't it?
Here's a way to do it:
WITH got_absent AS
(
SELECT pt_emp_code
pt_date - necessary only for date filtering
CASE
WHEN pt_hrs > 0
THEN 0
WHEN TO_CHAR (pt_date
, "DY".
'NLS_DATE_LANGUAGE = ENGLISH'
) <> 'FRI'
THEN 1
HOW much MONEY (SIGN (pt_hrs)) OVER (PARTITION BY pt_emp_code
ORDER BY pt_date
BETWEEN 1 PRECEDING
AND 1 SUITE
)<>
THEN 1
0 OTHERWISE
END as absent
OF pt_attendance_reg
-WHERE... - most filtering can go here
)
SELECT pt_emp_code
SUM (absent) AS no_of_days_absent
OF got_absent
WHERE the absent > 0
- AND pt_date > = TRUNC (SYSDATE, 'MONTH') - Date of filtering goes here
GROUP BY pt_emp_code
ORDER BY pt_emp_code
;
Output:
PT_EMP_CODE NO_OF_DAYS_ABSENT
------------ -----------------
R002 2
R003 4
R004 3
This assumes that there is exactly 1 row for each person, each day and that pt_hrs > = 0.
If the first date to a person is be a Friday, then that person is not counted as present the day before. Similarly, if the last day is a Friday, they will not be considered as present the next day, so they can be counted as absent on Friday, even though they were not really missing the Thursday or Saturday. This can be important if you filter by dates. Most filtering can be done in the subquery, but filtering dates must be done later, after the analytical function of the SUM is calculated.
-
analyze two times for each run?
Oracle 11.2.0.3 Std Ed One
Oracle Linux 64-bit 5.6
New guy was trying to use MS Data Integrator for 1.7 million lines of charge of MSSQL to Oracle. Process took more than 4 hours. I started an on the session 10046 trace, let it run for about 5 minutes, then produced the report tkprof. As I expected, the process was slow-by-slow transformation, issuing an INSERT for each line. But what I wasn't expecting, it is the count analysis was twice the number of execution. I am at a loss to explain this.
call County central processing unit elapsed disc query course lines ------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 83226 1.21 1.21 0 0 0 0 Run 41613 41,41 43.19 5 41732 282786 41613 Go get 0 0.00 0.00 0 0 0 0 ------- ------ -------- ---------- ---------- ---------- ---------- ----------
Total 124839 42,62 44,41 5 41732 282786 41613 Chess in the library during parsing cache: 1
Lack in the library during execution cache: 1
Optimizer mode: ALL_ROWS
I convinced the new guy to let me write a simple PL/SQL proc to do an INSERT... SELECT and it ran in under 4 minutes... but I'm still curious about this count analysis. In fact, I'm a bit puzzled by the results on my proc as well. This time, 1 run (as expected) but ZERO parsed?
call County central processing unit elapsed disc query course lines ------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 0 0.00 0.00 0 0 0 0 Run 1 106.03 193.34 14 484982 2433678 739292 Fetch 0 0.00 0.00 0 0 0 0 ------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 1 106.03 193.34 14 484982 2433678 739292 Chess in the library during parsing cache: 0
Lack in the library during execution cache: 1
Optimizer mode: ALL_ROWS
The analysis of the user id: 656 (recursive depth: 1). Clearly it 'parse' without 'run '.
I've seen this before.
Here is an example how it occurs when:
SQL statement with some analysis but no executions or extraction on the remote database SQL Distributed (Doc ID 580301.1)
Analysis number is high, but no executions (Doc ID 1335913.1)
-
What is a difference between 'Logical processors' and 'logical processors for each host?
Hi all!
In the official document VMware "vsphere-51-configuration-maxima" or "vsphere-55-configuration - maximums.pdf" in the section "ESXi host maximum rates------Maximums calculation" exists in the elements:
"Maximum CPU------logical CPU for each host ' (vSphere 5.1: 160;) vSphere 5.5: 320)
and
"Machine virtual maximums------virtual CPU by host ' (vSphere 5.1: 2048;) vSphere 5.5: 4096)
Question: what is the difference between the two?
And a more complex thing to maximum rates:
Virtual machines per host: 512
Number of hosts per cluster: 32
Therefore, the cluster may be Virtual Machines (maximum): 521 * 32 = 16384
But in the document, we have only 4000 VMs in maximum.
Why?
Thank you
Ramirez,
I understand your question as difference between 1. logic virtual CPU vs / by the hosts and 2. cluster/host Max County VM.
Consider the case below;
2 servers ESXi - 20 mV
ESXi taken 1-4, 2 cores / socket
ESXi 2-8 Sockets, 2 cores / socket
Now here number of CPU logic-(4 x 2) + (8 x 2) = 24
20 virtual machines - 2 jacks, 2 core / socket
Virtual CPU count - 20 x (2 * 2) = 80
Hope your first confusion is clear now.
And a more complex thing to maximum rates:
Virtual machines per host: 512
Number of hosts per cluster: 32
Therefore, the cluster may be Virtual Machines (maximum): 521 * 32 = 16384
But in the document, we have only 4000 VMs in maximum.
Why?
This means that even if you have 32 Guest and each host can accommodate 512 VMs each the maximum number of virtual machines per cluster may not exceed 4000. And it does not mean that you can have a maximum of VMS (512 * 32).
~ dGeorgey
-
Why pre-rendered footage get a new one made once again for each play or preview?
Dear Sir/Mdm,
I'm a novice, please bear with me.
I use an Asus laptop with:
1 CPU: Intel i5-3337U @ 1.80 GHz (4 processors)
2. operating system: 8.1 Windows 64-bit (6.3, build 9600)
3 RAM: 8 GB
4 DirectX: Version 11
5 edge graphics: Intel HD 4000
6 dedicated graphics card: GeForce GT 740 M
7 memory dedicated video: 2048 MB DDR3
8 Nvidia Driver version: 6.14.13.3523
9 total available graphics memory: 4096 MB
I was hoping to avoid made repeated segments of images during RAM glimpses, through scrub or proofreading.
I wrote before the associated layers of segments filled and pre-rendered the pre-comp, who gave a sequence (in AVI format) to replace the demo.
But when I scrub through, reading (space) or do we RAM previews, pre-rendered footage Gets a new rendering even once (for each scrub-via/preview/reading).
Need advice.
Thank you.
You wrong understand how Premiere Pro handles transitions and reading. Transitions, if the codec of the original film supports, can be rendered in real time, if the source codec is not, they are rendered when you preview so that the program window, the place watch you your video edited, acts as an existing media for the video player. Through playback engine is capable of reading multiple streams of video at the same time by using the Mercury playback engine.
After Effects is a software of compositing that pixels in layers and perform math on each pixel. If you have cache enabled and then rendered frames are not re-renderings when redo you the ram preview, but if you make any change in the scenario, everything from that point forward must be returned again because there is no easy way say which pixels will change in the layers after you make a change without the calculations.
AE is a great tool to produce the plans and short sequences, but it was never intended to be used as an editing program to assemble movies. It is simply not the right tool for this. Editing and Compositing integration will improve as both AE are more closely integrated, but it's like that with all of the software used to create a movie. Compositing is a separate operation of the Assembly, and they are managed differently.
-
How to maintain a sequence of number for each execution of the view
Hi all
I would like to implement a vision that returns the sequence number (say, at 1 and increment a (num = num + 1)) for each performance.
for example, first, it should be 1 and then for the excution second it takes 2...
What is the best way to implement this scenario?
Please advice me...
Thank youYou cannot do it directly:
SQL> create sequence s 2 / Sequence created. SQL> create view s_view 2 as 3 select s.nextval s_value 4 from dual 5 / select s.nextval s_value * ERROR at line 3: ORA-02287: sequence number not allowed here
You could:
SQL> create or replace 2 function s_func 3 return number 4 is 5 v_retval number; 6 begin 7 select s.nextval 8 into v_retval 9 from dual; 10 return v_retval; 11 end; 12 / Function created. SQL> create view s_view 2 as 3 select s_func s_value 4 from dual 5 / View created. SQL>
However, sequence will be calculated that whenever view column is referenced:
SQL> select ename, 2 s_value 3 from emp, 4 s_view 5 / ENAME S_VALUE ---------- ---------- MILLER 1 CLARK 2 KING 3 ADAMS 4 SMITH 5 JONES 6 FORD 7 SCOTT 8 JAMES 9 MARTIN 10 WARD 11 ENAME S_VALUE ---------- ---------- ALLEN 12 BLAKE 13 TURNER 14 14 rows selected. SQL> select ename, 2 s_value, 3 s_value 4 from emp, 5 s_view 6 / ENAME S_VALUE S_VALUE ---------- ---------- ---------- MILLER 15 16 CLARK 17 18 KING 19 20 ADAMS 21 22 SMITH 23 24 JONES 25 26 FORD 27 28 SCOTT 29 30 JAMES 31 32 MARTIN 33 34 WARD 35 36 ENAME S_VALUE S_VALUE ---------- ---------- ---------- ALLEN 37 38 BLAKE 39 40 TURNER 41 42 14 rows selected. SQL>
You could create the deterministic function, but it does not guarantee still sequence value will be calculated once per request.
SY.
-
Where is 'Create a separate record for each volume' past? in VMware-converter - 4.0.1 - 161434 (independent). Option is not more than 4 converter?
Hello.
When you get to the third tab called "View/Edit Options", choose the Edit option for 'Data to copy.' Then choose the option advanced at the end of the menu "data copy type" and then use the options on the page layout tab target to assign separate discs.
Good luck!
-
Use of user track in buckets of 48 hours for each month
I have an obligation to follow the use by the user in buckets of 48 hours for each month. For example, from midnight on 1st Oct, create buckets of 48 hours thanks to 23:59 on 31 Oct. For each user, how many times they use the system in each bucket 48 hours? I try to avoid PL/SQL, if I can so right SQL is preferred. Thank you very much in advance for your help.
Usage_Table (sample data)
ID User_Name Create_DateTime
This last 100 10/01/11 00:01:58
This last 101 01/10/11 01:02:31
102 user_B 02/10/11 14:44:32
This last 103 04/10/11 08:21:11
This last 104 04/10/11 03:10:20
105 user_B 05/10/11 12:50:30
106 and user_a 07/10/11 13:45:10
107 and user_a 07/10/11 18:22:08
Example of output
User_name From_DateTime To_DateTime Number_Of_System_Uses
This last 10/01/11 00:00:00 02/10/11 23:59:59 2
user_A 03/10/11 00:00:00 04/10/11 23:59:59 2
user_B 10/01/11 00:00:00 02/10/11 23:59:59 1
user_B 10/04/11 00:00:00 05/10/11 23:59:59 1
and user_a 10/06/11 00:00:00 07/10/11 23:59:59 2Hello
JoeCO wrote:
... I tried the outer join, but did not see the number 0. I'll keep playing with it.Sorry, my mistake. It was not nearly as simple as I said earlier. JOIN EXTERNAL means that all ranks of the cntr will appear in the result set at least once, but we need every line of cntr appear joining each month and user_name at least once, we can do with a partitioned outer join:
WITH cntr AS ( SELECT 2 * (LEVEL - 1) AS low_val , 2 * LEVEL AS high_val FROM dual -- CONNECT BY LEVEL <= 16 -- Max buckets in any month CONNECT BY LEVEL <= 4 -- For testing only ) , got_month_start AS ( SELECT user_name , create_datetime , TRUNC (create_datetime, 'MONTH') AS month_start FROM t_usage ) SELECT u.user_name , u.month_start + c.low_val AS bucket_start_date , u.month_start + c.low_val + 2 - (1 / (24 * 60 * 60)) AS bucket_end_date , COUNT (u.create_datetime) AS number_of_system_uses FROM cntr c LEFT OUTER JOIN got_month_start u PARTITION BY ( u.user_name , u.month_start ) ON ( u.create_datetime - u.month_start ) BETWEEN c.low_val AND c.high_val GROUP BY u.user_name , u.month_start , c.low_val ORDER BY u.user_name , bucket_start_date ;
As you can see, I also moved the calculation of TRUNC (create_datetime, 'MONTH') in a subquery.
I only showed the frist 4 buckets, just to simplify somewhat the exit during the original trial. The result is:` NUMBER _OF_ SYSTEM USER_N BUCKET_START_DATE BUCKET_END_DATE _USES ------ ------------------- ------------------- ------ user_A 10/01/2011 00:00:00 10/02/2011 23:59:59 2 user_A 10/03/2011 00:00:00 10/04/2011 23:59:59 2 user_A 10/05/2011 00:00:00 10/06/2011 23:59:59 0 user_A 10/07/2011 00:00:00 10/08/2011 23:59:59 0 user_B 10/01/2011 00:00:00 10/02/2011 23:59:59 1 user_B 10/03/2011 00:00:00 10/04/2011 23:59:59 0 user_B 10/05/2011 00:00:00 10/06/2011 23:59:59 1 user_B 10/07/2011 00:00:00 10/08/2011 23:59:59 0 user_C 10/01/2011 00:00:00 10/02/2011 23:59:59 0 user_C 10/03/2011 00:00:00 10/04/2011 23:59:59 0 user_C 10/05/2011 00:00:00 10/06/2011 23:59:59 0 user_C 10/07/2011 00:00:00 10/08/2011 23:59:59 2
-
Determine a value for each record for the whole group
< < Sorry I pasted erroneous results earlier > >
Hello
I have a table (in production, join the many tables, but for simplicity, I created a table), which has a few related accounts grouped by ACCT_GRP_ID I have to write a SQL (not a PL/SQL), who should have all columns of this table and an extra column "FLAG". For GA_CD = BBC, FLAG must have a value of 'No Show', if the APP_DT of at least a recording with the group is less than the current year also all the records in the group will have a value of 'Show '. For the record no BBC FLAG must always be 'Show '.
DDLS
{code}
CREATE TABLE ACCOUNTS
(NUMBER OF ACCT_GRP_ID,
GA_CD VARCHAR2 (10),
AGNT_NAME VARCHAR2 (50).
NUMBER OF CASE_NUM
NUMBER OF FUND_AMT
DATE OF APP_DT,
STATUS VARCHAR2 (10));
INSERT INTO ACCOUNT VALUES (1, 'BBC', 'SAMANTHA, JOSE, 12345, 234.33, 2 AUG 2008', ' PLACED');
INSERT INTO ACCOUNT VALUES (1, 'BBC', 'SAMANTHA, JOSE, 12346, 331,13, 24 APR 2009', ' PLACED');
INSERT INTO ACCOUNT VALUES (1, 'BBC', 'SAMANTHA, JOSE, 12347, 201,27, 13 FEB 2009', ' PLACED');
INSERT INTO ACCOUNT VALUES (2, 'BBC', ' MARK, ROSS, 12348, 98.12, 31 MAY 2009', 'PLACE' ");
INSERT INTO ACCOUNT VALUES (2, 'BBC', ' MARK, ROSS, 12349, 121.00, 25 JUNE 2009', 'PLACE' ");
INSERT INTO ACCOUNT VALUES (2, 'BBC', 'BRAND, ROSS, 12350, 11.00, 27 JUNE 2009', 'CLOSED');
INSERT INTO ACCOUNT VALUES (3, 'BBC', "RAJ MALIK", 12351, 89.00, 31 DEC 2008', 'PLACED');
INSERT INTO ACCOUNT VALUES (3, 'BBC', "RAJ MALIK", 12352, 22.00, 26 OCT 2008', 'PLACED');
INSERT INTO ACCOUNT VALUES (4, 'BBC', 'SHANE, WILLS', 12353, 443.00, 7 JUNE 2009', 'PLACE');
INSERT INTO ACCOUNT VALUES (5, 'BBC', 'JANE, WALLACE, 12354, 74.00, 17 JAN 2009', ' PLACED');
INSERT INTO ACCOUNT VALUES (NULL, 'BBC', 'ROSY, BETH', 12355, 124.00, 21 MAR 2009', 'PLACE');
INSERT INTO ACCOUNT VALUES (NULL, 'STAR', 'TINA, WZWICK', 22330, 89.00, 31 DEC 2008', 'PLACED');
INSERT INTO ACCOUNT VALUES (NULL, 'STAR', 'YANA, KORVIN', 27351, 22.00, 26 OCT 2008', 'PLACED');
INSERT INTO ACCOUNT VALUES (NULL, 'STAR', 'SARA, YUI', 22352, 443.00, 7 JUNE 2009', 'PLACE');
INSERT INTO ACCOUNT VALUES (NULL, 'STAR', 'MIKE, TROY, 22453, 74.00, 17 JAN 2009', ' PLACED');
COMMIT;
{code}
Required result:
{code}
APP_DT GA_CD AGNT_NAME STATE BOITE_ FUND_ ACCT_ INDICATOR
AMT NUM GRP_ID
1 SAMANTHA, JOSE PLACE 12347 201.27 BBC 13/02/2009 no show
1 SAMANTHA, JOSE PLACE 12346 331.13 BBC 24/04/2009 no show
1 SAMANTHA, JOSE PLACE 12345 234.33 BBC 08/02/2008 no show
MD2 BBC BRAND, ROSS CLOSED 12350 11 6/27/2009 see the
MD2 BBC BRAND, ROSS PLACED 12349 121 6/25/2009 see the
2 BRAND of BBC, ROSS PLACE 12348 98.12 show of 31/05/2009
3 BBC RAJ MALIK not PLACED 12352 22 10/26/2008 no show
3 BBC RAJ MALIK not PLACED 12351 89 12/31/2008 no show
4 BBC SHANE, WILLS PLACE 12353 443 6/7/2009 see the
5 BBC JANE, WALLACE PLACE 12354 74 1/17/2009 see the
STARS of MIKE, TROY PLACED 22453 74 1/17/2009 see the
See the BBC ROSE, BETH PLACED 12355 124 3/21/2009
STAR SARA, YUI PLACED 22352 443 6/7/2009 see the
TINA, WZWICK STAR PLACED 22330 89 12/31/2008 see the
YANA STAR, KORVIN PLACED 27351 22 10/26/2008 see the
{code}
As in the results Group 1 has a record with the date of 2008 for the whole group getting 'No Show'. Group 2 has all the records this year, so he gets the 'Show '.
Help, please!
Published by: Kuul13 on June 25, 2009 13:31
Published by: Kuul13 on June 25, 2009 13:43
I think I'm really having a BAD BAD day... Sorry again... I don't need the domain TOT_FUND_AMT...Hello
Thanks for posting the DDL and DML statements. This helps a lot.
I don't understand the output, however. Do you want to really two rows of output for each row in the table? The tot_fund_amt is copied from somewhere else? More important still, the results do not include the new flag column. Isn't the point of all of this question? It's good to describe how the indicator is calculated, but you have to show, too.
I think you want analytical MIN function to find the first app_dt in each group, like this:
SELECT a.* , CASE WHEN ga_cd = 'BBC' AND MIN (app_dt) OVER ( PARTITION BY ga_cd , acct_grp_id ) < TRUNC (SYSDATE, 'YYYY') THEN 'No Show' ELSE 'Show' END AS flag FROM accounts a ;
Output:
. ACCT _GRP GA CASE FUND _ID _CD AGNT_NAME _NUM _AMT APP_DT STATUS FLAG ------ ---- --------------- ------ -------- ---------- ------ ------- 1 BBC SAMANTHA, JOSE 12345 234.33 08/02/2008 PLACED No Show 1 BBC SAMANTHA, JOSE 12346 331.13 04/24/2009 PLACED No Show 1 BBC SAMANTHA, JOSE 12347 201.27 02/13/2009 PLACED No Show 2 BBC MARK, ROSS 12348 98.12 05/31/2009 PLACED Show 2 BBC MARK, ROSS 12349 121.00 06/25/2009 PLACED Show 2 BBC MARK, ROSS 12350 11.00 06/27/2009 CLOSED Show 3 BBC RAJ, MALIK 12351 89.00 12/31/2008 PLACED No Show 3 BBC RAJ, MALIK 12352 22.00 10/26/2008 PLACED No Show 4 BBC SHANE, WILLS 12353 443.00 06/07/2009 PLACED Show 5 BBC JANE, WALLACE 12354 74.00 01/17/2009 PLACED Show BBC ROSY, BETH 12355 124.00 03/21/2009 PLACED Show STAR TINA, WZWICK 22330 89.00 12/31/2008 PLACED Show STAR SARA, YUI 22352 443.00 06/07/2009 PLACED Show STAR MIKE, TROY 22453 74.00 01/17/2009 PLACED Show STAR YANA, KORVIN 27351 22.00 10/26/2008 PLACED Show
Note that the NULL acct_grp_id is a group. PARTITION BY acct_grp_id is of course necessary, but we must also, PARTITION BY ga_cd all non-BBC lines will be included in this group. In other words, we are unwilling reported as 'No Show', all ROSY just because TINA or JANA had an early app_dt.
-
Order a different number of prints for each image
If there is a way to order prints of different images different number?
Say I want to order a print of all my images in a collection of 4 x 6, simple enough.
Then, I want to order some of them also in format 8 x 10, also quite simple.
But what I can't find out how to order say; 3 copies of the #4 8 x 10 image, 2 copies of the #5 8 x 10 image and 10 copies of the image #14 in 8 x 10.
Something I m missing?
Any help is appreciated.
Thanks in advance.
- The options button lets you change the number of prints for each selected photo.
- The 'add pictures and change print sizes' button allows you to add additional formats and you can even select different amounts for each size.
See this help page: https://help.apple.com/photos/mac/1.0/?lang=en#/pht6e15ea68
-
Why I have to return my password for each song I buy on iTunes
At some point, iTunes began to requires me to enter my password for each song I buy. Usually, I do the search and buy on my Windows 7 desktop. I scoured my account looking for an explanation on why he has changed, but I think not all the controls that I maybe changed. Always in the past, once that I registered on my account, I could buy all the pieces I want without another password to sign in. This change took place a few months ago.
Thank you
Barb
This article may help:
Manage your iTunes Store and App Store - Apple Support password preferences
Read very carefully to see what password of the options you can set (especially with the Touch ID).
-
The sum of total revenue for each customer unique and graphic it!
Sunny greetings from Athens! I walked for 5 hours for an elegant solution to the following:
I want to add the total amount of revenue for each customer unique and graphic to view what customers bring in most of the species.
Example of this in it:
Customers Charged € A 100 B 200 C 250 A 130 A 120 B 100 Customers
Total € A 350 B 300 C 250 How this can be implemented by the numbers? As elegantly as possible?
Hi menick,.
SUMIF () will do the job.
the formula in table 2::B2 =.
SUMIF (table 1::A, A2, table 1::B)
It is filled down.
Quinn
-
I do my job to the computer on a MAC book PRO. I want to create a document using Pages and then convert the document to PDF and send a group email. I want to send the PDF using the pdf for each receiver icon must click the icon to open the document. My problem is the document does not show the icon, but rather the document is already open. I spoke with 2 Apple. 'Experts' care and can help me. Can someone tell me what to do?
It's a question of how the recipients e-mail programs deal with attachments. Many e-mail programs will open all the files they can handle, including files jpg and PDF, by default, and if the recipient has not changed that there is nothing you can do about it. The only solution is to the compress first, then it will be delivered as an attachment, allowing the recipient to decompress and open it.
Maybe you are looking for
-
Unable to connect to the App Store and auto delete app
Hi, I never update my ipad because I never, and I do not have the space for it anyway. Now and then I get the message saying ipad needs space for the update, press ok to allow deletion, or something in that sense. Theres two options cancel or ok. Tod
-
Cannot run installed FS2004 A Centuary of Flight
After installing a real Flight Simulator 2004, failed to get his execution. There is an error message "the detected version of FS2004 is not compatible with this version of FSUIPC. It is build 9.01.40901... You need the correct version of FS2004.
-
Original title: change file attributes I'm updating some drivers help Driver Whiz from HP. The new drivers download but will not be installed. Apparently, I need to remove the read-only file attributes, but no matter what I do it continues to chang
-
Windows7 Media Player don't Rip. CD Rip icon is grayed out.
I re-installed the player twice. Why am I not able to Rip? Everyone fell on this? I just built a new computer with a MSI motherboard, i5 processor-all very nice and very fast, with the installation had to repalce my CD ROM to Use the SATA port. Not r
-
Smartphones blackBerry documents to go
By mistake I had deleted Documents integrated to Go app. During the installation of pdf reader on your system invited to remove the previous edition of the app. There is now no app. On the device. I use 8520. Is it possible to re install the document