Help: Group by condition
Hello people am actually trying to figure out that we can use the following condition IE "to_char (sysdate, 'YYYY FMMon'),' in the group by clause, or can I use the alias 'Period' instead, can someone please shed some light on this.SELECT the customer. Name of the customer,
"CUBS SNAPSHOT. Flag HMG,
Select TRUNC (SYSDATE, 'MONTH') - 1 from AS double, PeriodThruDate,.
Select to_char (sysdate, 'FMMon YYYY') of double period AS
"CUBS SNAPSHOT", customer
Customer GROUP. Name of the customer,
"CUBS SNAPSHOT. CUSTOMER,
"CUBS SNAPSHOT. TYPE,
. ClipStatus "CUBS SNAPSHOT."
"CUBS SNAPSHOT. SUBTYPE,
TO_CHAR (sysdate, 'YYYY FMMon'),
"CUBS SNAPSHOT. Flag HMG,
TRUNC (SYSDATE, 'MONTH') - 1
Thank you
Ok
select TRUNC (SYSDATE, 'MONTH') - 1 from dual AS PeriodThruDate,
is not necessary, it can be simply.
TRUNC (SYSDATE, 'MONTH') - 1 AS PeriodThruDate,
So UNLESS you are nesting this SQL and do a group outside that, you cannot reference the alias.
so you have to
GROUP BY TRUNC (SYSDATE, 'MONTH') - 1
OR you can nest the functioning and the alias on the outside group
select
from
(
select
TRUNC (SYSDATE, 'MONTH') - 1 AS PeriodThruDate
from ...
)
group by PeriodThruDate
Tags: Database
Similar Questions
-
problem with the help of the conditional formatting on a cell that is defined as the percentage
Hi all
I am facing a problem with the help of the conditional formatting on a cell that is defined as the percentage.
I am using beaches for example:
is equal to or greater than 10% - green color
5%-10%-yellow
less than or equal to 5%-color red
the problem is that keeps the value 10% get yellow color when it should get green.
i thought that is a rounding issue but when I change the definitions of the cell to learn more decimal places I see this part of the percentage 9.65% and some of them are 10.00% and they are both colored in yellow.
I also tried to change the way range of 6 to 9%, but values between 9.65% or 5.5% are not colored.
I really enjoy your help!
You know the reason and the solution.
change the format of the column and go or add a column more with decimal and opt for conditional and hide report.
Thank you
-
Need help on the conditional display of row group
Hello
I have a requirement like, display a set of grouped lines, take for example employees table, in which the whole of the wages for a particular service must be greater than a value.
The record of employees for which the Department satisfied the condition should be displayed.
for example:
-Here's the query
SELECT deptno, ename, empno, job, SUM (sal)
WCP
GROUP OF ROLLUP (deptno, (empno, ename, job))
-Here is the output
DEPTNO EMPNO, ENAME, JOB SUM (SAL)
10 7782 CLARK MANAGER 9999
10 7839 Sendhil PRESIDENT 10000
10 7934 MILLER CLERK 6666
10 26665
20 7369 SMITH CLERK 7845
20 7499 ALLEN CLERK 5689
20 TOM 7566 MANAGER 4444
20 7788 Senthil ANALYST 7777
20 7876 ADAMS CLERK 5555
20 sendeel 7902 ANALYST 7765
20 39075
30 7900 JAMES CLERK 5566
30 7654 MARTIN SALESMAN 2222
30 7698 BLAKE MANAGER 8888
30 7844 TURNER SELLER 6666
30 23342
89082
-In the above example, I want to check which Department is to have a total wage greater than 30000, and the details of employee in this one particular Department should appear.
I think that the subquery should be used for this requirement.
Please help me in this.
Kind regards
ShivaHello
Here is your answerSQL> select * from emp; EMPID FNAME LNAME SALARY DEPT_ID ---------- ---------- ---------- ---------- ---------- 1 Ajay Shashtri 5000 2 2 Vijay Dawan 8000 3 3 Suresh Sharma 10000 2 4 Kamal Verma 10000 3 SQL> SELECT dept_id, empid, fname, SUM (salary) as SAl 2 FROM emp 3 GROUP BY ROLLUP (dept_id, (empid, fname)); DEPT_ID EMPID FNAME SAL ---------- ---------- ---------- ---------- 2 1 Ajay 5000 2 3 Suresh 10000 2 15000 3 2 Vijay 8000 3 4 Kamal 10000 3 18000 33000 7 rows selected. SQL> with Subq as 2 (Select dept_id as dept from emp group by dept_id 3 having Sum(Salary) >16000) 4 SELECT dept_id, empid, fname, SUM (salary) as SAl 5 FROM emp 6 where dept_id in (select dept from subq) 7 GROUP BY ROLLUP (dept_id, (empid, fname)); DEPT_ID EMPID FNAME SAL ---------- ---------- ---------- ---------- 3 2 Vijay 8000 3 4 Kamal 10000 3 18000 18000 SQL>
Concerning
Umesh
-
With the help of case condition for the date of distinct values is does not
Hello PL/SQL gurus and experts.
I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64-bit Production version
I followed two tables
TT3-
TT4create table TT3(FeesCntlr,CommCntlr,LatePayCntlr,Name,Age) as select 1,11,21,'Mike',25 from dual union all select 2,12,22,'Clark',26 from dual union all select 4,17,27,'Ussan',28 from dual union all select 5,13,21,'Linda',29 from dual union all select 6,14,24,'Obrek',35 from dual union all select 7,15,25,'Batty',45 from dual union all select 8,16,26,'Nicky',38 from dual;
Now, if I use the following DML for the year 2012, then the result is as follows-drop table TT4; create table TT4(TRNID,BlockID,FeesCntlr,CommCntlr,LatePayCntlr,BookDate) as select 221,625,1,11,21,20121101 from dual union all select 223,625,2,12,22,20121101 from dual union all select 224,625,1,11,21,20121101 from dual union all select 225,627,4,17,27,20111001 from dual union all select 226,628,5,13,21,20120701 from dual union all select 227,628,6,14,24,20120701 from dual union all select 334,628,7,15,25,20120701 from dual union all select 339,629,8,16,26,20120701 from dual union all select 393,629,1,11,21,20120701 from dual union all select 432,629,2,12,22,20120701 from dual union all select 347,629,1,11,21,20120701 from dual union all select 556,629,4,17,27,20120701 from dual union all select 558,629,5,13,21,20120701 from dual union all select 974,629,6,14,24,20120701 from dual union all select 976,629,7,15,25,20120701 from dual union all select 980,629,8,16,26,20120701 from dual union all select 1223,650,2,12,22,20110415 from dual union all select 1224,650,1,11,21,20110415 from dual union all select 1225,650,4,17,27,20110415 from dual union all select 1226,650,5,13,21,20110415 from dual union all select 1227,650,6,14,24,20110415 from dual union all select 1334,650,7,15,25,20110415 from dual union all select 1339,710,8,16,26,20120115 from dual union all select 1393,710,1,11,21,20120115 from dual union all select 1432,710,2,12,22,20120115 from dual union all select 1347,710,1,11,21,20120115 from dual union all select 1556,710,4,17,27,20120115 from dual union all select 1558,711,5,13,21,20111231 from dual union all select 1974,711,6,14,24,20111231 from dual union all select 1976,711,7,15,25,20111231 from dual ;
Now, if I use the following DML for 2011, then the result is as follows-SQL> select t3.Name,t3.age,count(t4.TRNID),count(distinct(BlockID)) from 2 tt3 t3,tt4 t4 3 WHERE t3.feescntlr = t4.feescntlr 4 AND t3.commcntlr = t4.commcntlr 5 AND t3.latepaycntlr = t4.latepaycntlr 6 AND t4.bookdate between 20120101 and 20121120 7 GROUP BY t3.name, t3.age; NAME AGE COUNT(T4.TRNID) COUNT(DISTINCT(BLOCKID)) ----- ---------- --------------- ------------------------ Mike 25 12 3 Mike 27 12 3 Batty 45 4 2 Clark 26 6 3 Linda 29 4 2 Nicky 38 6 2 Obrek 35 4 2 Ussan 28 4 2 8 rows selected.
But by using the condition if I use the following dml and results do not match-SQL> select t3.Name,t3.age,count(t4.TRNID),count(distinct(BlockID)) from 2 tt3 t3,tt4 t4 3 WHERE t3.feescntlr = t4.feescntlr 4 AND t3.commcntlr = t4.commcntlr 5 AND t3.latepaycntlr = t4.latepaycntlr 6 AND t4.bookdate between 20110101 and 20111120 7 GROUP BY t3.name, t3.age; NAME AGE COUNT(T4.TRNID) COUNT(DISTINCT(BLOCKID)) ----- ---------- --------------- ------------------------ Mike 25 2 1 Mike 27 2 1 Batty 45 2 1 Clark 26 2 1 Linda 29 2 1 Obrek 35 2 1 Ussan 28 4 2 7 rows selected.
As the expected output, that I expect - isSQL> select Name,Age,sum(Trn),sum(CurYrOrdr) "2011 Order", sum(LastYrOrdr) "2012 Order" 2 from 3 ( 4 select t3.Name,t3.age,count(t4.TRNID) Trn,(case when t4.bookdate between 20110101 and 20111231 then count (distinct(BlockID)) else 0 end) CurYrOrdr, 5 (case when t4.bookdate between 20120101 and 20121120 then count (distinct(BlockID)) else 0 end) LastYrOrdr 6 from 7 tt3 t3,tt4 t4 8 WHERE t3.feescntlr = t4.feescntlr 9 AND t3.commcntlr = t4.commcntlr 10 AND t3.latepaycntlr = t4.latepaycntlr 11 AND t4.bookdate between 20110101 and 20121120 12 GROUP BY t3.name, t3.age,t4.bookdate 13 ) 14 group by Name,Age order by Name,Age; NAME AGE SUM(TRN) 2011 Order 2012 Order ----- ---------- ---------- ---------- ---------- Batty 45 8 2 2 Clark 26 8 1 3 Linda 29 8 2 2 Mike 25 14 1 3 Mike 27 14 1 3 Nicky 38 6 0 2 Obrek 35 8 2 2 Ussan 28 8 2 2 8 rows selected.
I sincerely thank each of you in advance for the input/comments that I fight with it for some time now.---------------------------------- Expected Output - NAME AGE "2012 TRNID" "2011 TRNID" "2012 ORDERID" "2011 ORDERID" ----- ---------- --------------- ----------------------------- ---------- ------------ Mike 25 12 2 3 1 Mike 27 12 2 3 1 Batty 45 4 2 2 1 Clark 26 6 2 3 1 Linda 29 4 2 2 1 Nicky 38 6 2 2 1 Obrek 35 4 2 2 1 Ussan 28 4 4 2 2
Kindly help.user555994 wrote:
Hi JAC
Thanks for the comments and certainly once I comment out the following line.
- AND t4.bookdate between 20110101 and 20111120then the values are adapting, but at the same time why do we need to comment the date range condition as case is just a filter and not the condition.
filter should be-
AND t4.bookdate between 20110101 and 20121120 --"made it 12"
-
Help for a conditional indexation in LV 2012?
Not that I need, but I couldn't find any help on the new feature of LV 2012 conditional indexation. It appears in the context menu, but context-sensitive help provides no hint what it is, and it is not found in Help:
You can find help here section, even if it has enough thin - http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/condacc_valuesnloops/
I can say that the performance has been tested during the beta and that the performance is identical to help to build array in a structure of housing. I guess NEITHER will change that to have better performance, but I don't know when.
-
With the help of JavaScript condition in the dynamic action of JQuery selector
Hi guys,.
I have a Setup master detail on a page.
The detail section, I have a tabular presentation. One of the fields is a selection list. The first record in the select contains the value * not * that has a value of primary key for the 1. I have a distinct region with a simple text field where the user can insert a value into the table if the value does not exist.
I want than the region of text element to only appear if the value * not listed * is selected.
I managed to make it work when the value is selected with the help of dynamic action with a bit of JQuery and JavaScript by setting the ID on the selection list to 'create' and have the following in JavaScript $(this.triggeringElement) .val ()! = 1 in the JavaScript for dynamic action condition shows it or hides the region of 'create' and that works well.
However, if the secondary table is empty before the detail records were created (nothing selected in triggering jQuery Selector) the region of create is displayed when I don't want it.
I guess I need some sort of NVL in JavaScript condition?
I use APEX v4.2.
Any advice would be appreciated.
Chris
Cashy wrote:
I have a Setup master detail on a page.
The detail section, I have a tabular presentation. One of the fields is a selection list. The first record in the select contains the value * not * that has a value of primary key for the 1. I have a distinct region with a simple text field where the user can insert a value into the table if the value does not exist.
I want than the region of text element to only appear if the value * not listed * is selected.
I managed to make it work when the value is selected with the help of dynamic action with a bit of JQuery and JavaScript by setting the ID on the selection list to 'create' and have the following in JavaScript $(this.triggeringElement) .val ()! = 1 in the JavaScript for dynamic action condition shows it or hides the region of 'create' and that works well.
However, if the secondary table is empty before the detail records were created (nothing selected in triggering jQuery Selector) the region of create is displayed when I don't want it.
I guess I need some sort of NVL in JavaScript condition?
I use APEX v4.2.
Simple solution is to hide the region containing the element of text by default, using the style = "" view: no ' in the property of the attributes of the area in the region. " It will be always hidden when the page initially, but its visibility will be controlled by the DA subsequently.
-
Hello
I have a table of PRODUCTS like this:
ID COD_PROD CAT STATUS PRICE DT
1 P1 C1 SOLD 10 10/7 / 2015 12:23
P1 C1 CANCELLED 10 10/7 2 / 2015 12:24
3 P1 C1 SOLD 10 10/7 / 2015 12:25
4 P2 SOLD C1 12 10/7 / 2015 12:26
5 P2 C1 CANCELLED 10/7 12 / 2015 12:27
P3 C2 SOLD 13 10/7 6 / 2015 12:28
I need to group them by category (CAT) and the PRICE of the sum in order to show how much of each category.
The problem is on the STATUS column, because I have to examine all documents having the status of last '' SOLD '' =
In the table above, the query must obtain P1 and P3
Any help?
Thank you
PM
This part:
WITH DATA (ID, COD_PROD, CAT, LOCATION, PRICE, DT)
AS (SELECT 1, 'P1', 'C1', 'SOLD', 10, to_date (October 7, 2015 12:23 ',' dd/mm/yyyy hh24:mi:ss') FROM dual UNION ALL)
SELECT 2, 'P1', 'C1', 'CANCELLED', 10, to_date (October 7, 2015 12:24 ',' dd/mm/yyyy hh24:mi:ss') FROM dual UNION ALL
SELECT 3, 'P1', 'C1', 'SOLD', 10, to_date (October 7, 2015 12:25 ',' dd/mm/yyyy hh24:mi:ss') FROM dual UNION ALL
SELECT 4, 'P2', 'C1', 'SOLD', 12, to_date (October 7, 2015 12:26 ',' dd/mm/yyyy hh24:mi:ss') FROM dual UNION ALL
SELECT 5, 'P2', 'C1', 'CANCELLED', 12, to_date (October 7, 2015 12:27 ',' dd/mm/yyyy hh24:mi:ss') FROM dual UNION ALL
6. SELECT "P3", "C2", "SOLD", 13, to_date (October 7, 2015 12:28 ',' dd/mm/yyyy hh24:mi:ss') FROM dual)
is simply because I do not have the table, so you'll not need just uses your name to the table here:
WITH getlaststatus (SELECT ID, cod_prod, chat, location, price, dt
first_value (status) OVER (PARTITION BY cat, cod_prod dt to ORDER BY DESC) AS last_status,
row_number() (PARTITION BY cat, cod_prod dt to ORDER BY DESC) AS last_action
Of your_table_name)
SOME cats, Sum (Price)
OF getlaststatus
WHERE last_status = 'SOLD '.
AND last_action = 1
Chat group
/
If this solution uses only the last record of a combination of cat/cod_prod if it is a status of SOLD.
HTH
-
Hello guys,.
What I have to do, is to modify an existing report that is in the table style to the group above data model.
First, I changed the data model to extract the existing data model group and I got no problem with that.
Secondly, I added grouping framework for my new recordings of grouping (master) and put inside the previous image of grouping (details).
The problem is when I generate the report that each record is separated by a huge empty line:
This photo shows this blank line between records:
[IMG] http://I59.Tinypic.com/bdl46p.jpg [line]
I think I tried everything, I even deleted all the fields of the report and left only my two group executives, but problem still exist.
This is my body of report:
[IMG] http://i62.Tinypic.com/28a3u5l.jpg [line]
If you have ideas, what can be wrong or what to do, please help
You mean, there's already detailed report, now you want to change to master detail (group above).
At the level of the model:
You divided the existing group into two bases on simple request, haven't you? means there are now two group master and detail.
means, group existing, becoming a master and detail created a new group. Let's say that G1 is the master (existing) and G2 (new) group retail.
If above understanding is correct then proceed as follows
Place the new extensible framework (say RG2) within the existing extensible framework (let say RG1 and assign the name of the new group G2 to RG2. framework and place all the Group detail fields in extensible framework newly established RG2.
Hopefully, you will get the expected changes in this way.
-
Need help with the condition join in SQL
Hi all -
I need to ask for help with this query:
Create table user_tab_col_test (varchar2 (30) from table_name, column_name varchar2 (30), data_type varchar2 (30));
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table1', 'column1', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('Column2', 'table1', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ("Column3", 'table1', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('column4', 'table1', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ("column1", "table2", 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table2', 'column2', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table2', "Column3", 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table2', 'column4', 'varchar2')
Commit;
Create table all_cons_columns_test (varchar2 (30) from table_name, column_name varchar2 (30), constraint_name varchar2 (30))
Insert into all_cons_columns_test (table_name, column_name, constraint_name) values ("table1", "column1", "primary")
Insert into all_cons_columns_test (table_name, column_name, constraint_name) values ("table1", "column1", "secondary")
Commit;
This is my query and the current result:
Select u.table_name, u.column_name, c.constraint_name
Of user_tab_col_test u
Outer join all_cons_columns_test c left
On (u.table_name = c.table_name
AND U.COLUMN_NAME = C.COLUMN_NAME
AND C.CONSTRAINT_NAME IN ('main'))
order of U.table_name, U.COLUMN_NAME;
TABLE_NAME COLUMN_NAME, CONSTRAINT_NAME
------------------ --------------------- ----------------------------
Table1 primary Column1
Table1 Column2
Table 1 Column3
Table2 Column1
Table2 Column2
Three questions:
(1) I don't want to return results where table_name = "table1". I can't get this to work.
(2) is my proper request and this is the best way to return my desired results? For example, I want all of the columns of user_tab_col_test and I want to only display the constraint_name from all_cons_columns_test argument if the argument constraint_name = 'primary '.
(3) will be the synatx be the same if I need to join a third table to all_cons_columns_test?
Any advice/suggestions are appreciated-
John
Published by: user703358 on January 11, 2013 20:57
Published by: user703358 on January 11, 2013 21:48Hi, John,.
user703358 wrote:
Hi all -I need to ask for help with this query:
Create table user_tab_col_test (varchar2 (30) from table_name, column_name varchar2 (30), data_type varchar2 (30));
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table1', 'column1', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('Column2', 'table1', 'varchar2')...Thanks for posting the CREATE TABLE and INSERT.
It is more useful if you post the code that can be run without modification. You did not semicolons after INSERTION instructions.Three questions:
(1) I don't want to return results where table_name = "table1". I can't get this to work.What have you tried? Post your best attempt.
Here's one way:SELECT u.table_name , u.column_name , c.constraint_name FROM user_tab_col_test u LEFT OUTER JOIN all_cons_columns_test c ON u.table_name = c.table_name AND u.column_name = c.column_name AND c.constraint_name IN ('primary') WHERE u.table_name = 'table1' -- ***** NEW ***** ORDER BY u.table_name , u.column_name ;
You would not put this condition in the clause; who controls what is considered as a match between the tables, and "u LEFT OUTER JOIN c" means show all lines of u, even if they do not have a match in the c.
(2) is my proper request and this is the best way to return my desired results? For example, I want all of the columns of user_tab_col_test and I want to only display the constraint_name from all_cons_columns_test argument if the argument constraint_name = 'primary '.
Basically, this application is very well.
It displays all the columns of user_tab_col_test; missing data_type. Just add u.data_type to the SELECT clause, or change the SELECT clauseSELECT u.* , c.constraint_name
(3) will be the synatx be the same if I need to join a third table to all_cons_columns_test?
Do you mean "" * add * one-third * column * to all_cons_columns_test '? "
It depends on what results you want. Post new CREATE TABLE and INSERT and instructions the results you want new data.
Most likely, the basic structure of what you've written will remain exactly the same. -
Need help with Audio conditional
Hello again! So from the outset in a course, after a few slides of intro, I have a slide tri to direct users to other parts of a course (autonomous learning directed manner). However, I have an audio narration that plays at the entrance to this slide (slide no audio, it plays by advanced actions). I'm trying to find a way so that once they have seen this slide once on hearing and audio first, any time that they get referred to this yard slide, they hear no audio again. How this could be done?
What I've tried: I tried two things, first of all I created a variable called Sort_Audio. Sort_Audio would be assigned to the output of the previous slide, a value of 10. At the entrance to the slide of sort, a tip action would check if Sort_Audio is equal to 10. If this is the case, it plays audio (and clears that another variable that is not related, I just need to do two things, I combined the). I have on the output of the triage blade a tip action that resets Sort_Audio to 0 so that when a user gets referred to this yard slide, it would theoretically not featured audio. Problem is in the first place for a reason any, it will play not even audio first.
The other thing I tried was quite similar, but instead to assign values to the slides, I tried cpInfoLastSlideViewed and he equalled in the name of the previous slide, but also do the same for cpInfoPreviousSlide. None seemed to work.
Any help would be appreciated! Thank you!
I have demonstrated this workflow many times (DevLearn 2012, recently on an eLearning Guild online forum).
You use any of the Exit event. Have a user with a value variable initial (I used 0). Create a conditional action:
IF v_visit equals 0
Play the audio clip
Assign the v_visit with 1
ON THE OTHER
Continue
Lilybiri
-
With the help of several conditional tags with multiple outputs of WebHelp
I have a project that I created for a web application. Within the web application, there are 3 types of customers (business Accts, Accts National and level 1 clients).
I added each help topic associated with the help topics that I created.
Then, I created 3 outputs of webhelp and 3 Table of contents for each type of client.
My goal is to publish the project, where each type of client has their own output generated. Do it this way, which is listed in the help topics of table of contents for each type of customer that is not correctly displayed.
Example: National accounts TOC
What is generated:
I have tagged in the table of contents to the conditional tag appropriate help topics. Help, please. Any advice? I can also be reached at [email protected]
None of your screenshots came through - the icon of camera in the web interface allows you to attach images
-
need help for a conditional query
guys this is just. as an extension of this post that Frank was helping me. IM reposting because my needs change slightly and im having a hell of a time trying to change the query.
Here are the previous post.
need help with query can find data back please help.
dataCREATE TABLE "FGL" ( "FGL_GRNT_CODE" VARCHAR2(60), "FGL_FUND_CODE" VARCHAR2(60), "FGL_ACCT_CODE" VARCHAR2(60), "FGL_ORGN_CODE" VARCHAR2(60), "FGL_PROG_CODE" VARCHAR2(60), "FGL_GRNT_YEAR" VARCHAR2(60), "FGL_PERIOD" VARCHAR2(60), "FGL_BUDGET" VARCHAR2(60) )
I need to find the year of greater subsidy for the granting by a period setting.Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100'); Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');
Once I found the great year, I need to check the value of the period 14 this grant for the previous year and add it to the amount of the budget for this grant. However if there is an entry in the biggest year for period 00 so I need to ignore the period 14 of the previous year and the current calculation period + (current period - more great year 00)
hope that makes sense, so in other words, with the new data above. If I asking me a second period of the grant year 11. I'd end up with $800
because the greatest year is 11 it contains one point 0 with $ 400, so my total should be
amount of period $2,600
period $0 400 - period $2 600 = $200
600 + 200 = $800
If I have question period 1 grant 360055 I'd end up just with 800 grnt year 10.
I tried to edit this query you have provided me with no luck. I tried for several embarrassed day but I'm saying I can just do what im trying to do.
can you please help me.
Here's the query provided by frank kulash who graciously put it together for me.
MiguelWITH got_greatest_year AS ( SELECT fgl.* -- or whatever columns are needed , MAX ( CASE WHEN fgl_period = :given_period THEN fgl_grnt_year END ) OVER () AS greatest_year FROM fgl ) SELECT SUM (fgl_budget) AS total_budget -- or SELECT * FROM got_greatest_year WHERE ( fgl_grnt_year = greatest_year AND fgl_period = :given_period ) OR ( fgl_grnt_year = greatest_year - 1 AND fgl_period = 14 ) ;
Hi, Miguel.
You are waying that when larger year who has: given_period also a period = '00' (or '0', or whatever it is you want to use), then you want to double the budget of the given_period (subtract the '00' budget and do not count '14' year pevious)? If so, add another condition to the CASE statement that decides what you've summarized:
WITH got_greatest_year AS ( SELECT TO_NUMBER (fgl_grnt_year) AS grnt_year , fgl_period , TO_NUMBER (fgl_budget) AS budget , MAX ( CASE WHEN fgl_period = :given_period THEN TO_NUMBER (fgl_grnt_year) END ) OVER () AS greatest_year FROM fgl ) , got_cnt_00 AS ( SELECT grnt_year , fgl_period , budget , greatest_year , COUNT ( CASE WHEN grnt_year = greatest_year AND fgl_period = '00' THEN 1 END ) OVER () AS cnt_00 FROM got_greatest_year ) SELECT SUM ( CASE WHEN grnt_year = greatest_year -- New AND fgl_period = :given_period -- New AND cnt_00 > 0 THEN budget * 2 -- New WHEN grnt_year = greatest_year AND fgl_period = :given_period THEN budget WHEN grnt_year = greatest_year AND fgl_period = '00' THEN -budget WHEN grnt_year = greatest_year - 1 AND fgl_period = '14' AND cnt_00 = 0 THEN budget END ) AS total_budget FROM got_cnt_00 ;
You will notice it is the same as the previous query, I posted, with the exception of 3 lines marked 'new '.
-
Help! ; apply conditional text
Hi forum,
I have the script and edited to create and apply conditional text which I substituted in find what.
but I guess, done wrong by using the properties of the text conditional im...
any body could help on this...
myCondition = app.activeDocument.conditions.add ({name: "Condition 1",})
indicatorMethod:ConditionIndicatorMethod.USE_HIGHLIGHT, indicatorColor:UIColors.YELLOW});
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = "(?) (i)(your|you|our) ";
app.changeGrepPreferences.applyConditons = "Condition 1";
app.changeGrep ();
Thank you
shil...
Hello
Errors shows the syntax and General;
working version:
myCondition = app.activeDocument.conditions.item ("Condition 1");
If (! myCondition.isValid)
{
myCondition = app.activeDocument.conditions.add ({name: "Condition 1",})
indicatorMethod:ConditionIndicatorMethod.USE_HIGHLIGHT, indicatorColor:UIColors.YELLOW});
}
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = "(?) (i)(your|you|our) ";
app.changeGrepPreferences.appliedConditions = ["Condition 1"]; "appliedConditions" & table as a value;
app.changeGrep ();
Enjoy
-
Please help - show/hide conditional and Message boxes also E-mail questions
I have created a dynamic to complete XML form which is a survey on page 14. It has a series of yes/no radio buttons that hide/show additional questions. The investigation must perform several other functions as well. Ten questions are mandatory, that I put in the object palette. If a user selects "No" to one of these ten questions, an additional page should appear at the end of the investigation, they end. Currently, if a user selects 'No' appears the extra page, but if the user changes a response "" for the "Yes" of the page doesn't go away. The script that I have for this is the following:
If (Comp1No.selectedIndex == 2
|| Page4.Comp2.Comp2No.SelectedIndex == 2
|| Page5.COMP3.Comp3No.SelectedIndex == 2
|| Page6.Comp4.Comp4No.SelectedIndex == 2)
(keep the same model at 10)
{
CorrectiveAction.presence = "visible";
}
else {}
CorrectiveAction.presence = 'hidden ';
}
The user will submit the survey by clicking on a "Send by E-mail" button at the bottom of the form. I need add action preSubmit who reviews responses to the ten mandatory questions and returns a message to the user stating "You must complete a Correction Action Plan" if one answer is 'no '. I have currently a mailto:[email protected] in the object tab palette submit to submit it to the URL: field and PDF in the field send in as long as I need a pdf of the document copy returned to me attached to the e-mail. Finally, I would like to make the page corrective measures an element required if one of the answers to the required questions are 'No', but do not know how to do conditional mandate as responses from the user are all 'yes' of the remedy is not compulsory.Can you give me any assistance would be greatly appreciated. I have no HTML programming, or help Javascript knowledge and I am a tent to fumble my way through this project help, forums and any other information source available. Thank you.
I looked at the form and found something...
You reference the Pages as Page3, Page4, Page5 etc. in your code... But in reality you donot have a subform named page 3 / page 4 / page 5 in your form. If you look at the attached schema, you will understand that in the hierarchy, he resembled Page3 but if you look at the Script Editor in your code for the event, you can see the actual reference to the Yes option button.
Real path for Comp1Yes button: #subform [2].Comp1.Comp1Yes::mouseUp of form1.
You referenced in your code like: Page3.Comp1.Comp2No.selectedIndex == 2...
To make your code work, you must change the subform to Page3 / Page4 etc.
Go to the Menu window - > hierarchy and select "(Untitled Subform) (Page3)" and press F2. " Change the name on page 3. Do the same for each page that you have in your form... Can you select the Comp1Yes button and you should see the correct path in the Script Editor.
Form1.page3.COMP1.Comp1Yes::MouseUp
In this way, you can refer to page 3 / page 4 etc. in your code.
I would like to know if that helps...
Thank you
Srini
-
Hey all,.
I'm having a hard time with this one, any help would be appreciated.
I have a table with 4 fields:
ID, HAND, TIME, SPD
It should look like this
ROWID, ID, HAND, TIME, SPD
1, AA, 01, 1: 45
2, AA, 02, 1, 44
3, AA, 02, 2: 33
4, AA, 03, 3: 44
5, AA, 02, 5, 55
etc.
What I have to do is to get an AVERAGE of the SPD column
where I GROUP by ID, HAND and (here is the hardest part) TIMES (ONLY if its sequential)
By ROWID
1 would remain the same.
2 and 3 would be on average because ID, HANDS are the same and the TIME is sequential
4 and 5 remain the same...
looked analysis AVG to see if I could just create a moving average (partitioned by ID, HAND), but she always ends up with an average of rows 2, 3 and 5. I imagine you could do with PL/SQL but not well versed in the sliders and the table that I it would run on the numbers in the billions of lines...
Thanks in advance,
EricIf I understand correctly.
with t as ( select 1 r1, 'AA' id , 01 m1, 1 t1 , 45 spd from dual union all select 2, 'AA', 02, 1, 44 from dual union all select 3, 'AA', 02, 2, 33 from dual union all select 4, 'AA', 03, 3, 44 from dual union all select 5, 'AA', 02, 5, 55 from dual ) select id,m1,avg(spd) from (select m1,r1,id,t1,grp,spd from t model partition by (m1) dimension by (row_number() over (partition by m1 order by r1) rn ) measures (r1,id,t1,spd,lag(t1) over ( partition by m1 order by t1) next_t1,1 grp, 1 grprec) rules upsert iterate(1000) until(presentv(t1[iteration_number+2],1,0)=0) (grprec[any] = nvl(grp[cv()-1],1), grp[any]= case when nvl( next_t1[cv()]+1,t1[cv()]) =t1[cv()] then grprec[cv()] else grprec[cv()]+1 end)) group by id,m1,grp
output
44 3 AA
55 2 AA
45 1 AA
AA 2 38.5Published by: alvinder on March 4, 2009 09:51
Correction of the error I made.
Maybe you are looking for
-
can not get the bandwidth used for Wildblue but can be downloaded on IE
We have a counter for the use of the Service by Wildblue Satellite bandwidth. 2 days ago it stop working. If I change from Firefox to IE, it works. Any ideas?
-
Search engine does not work.
The google search engine thingy next to the web address does not work. I can type stuff in there, but pushing enter or the magnifying glass does not get for research. For some reason, it seems to work perfectly on privacy, but not regular navigation.
-
Tecra 8100 does not start.
Hello. I have this Tecra 8100 I think sell for parts, because I am crazy about her. But before that, I ask you here as a last. It seems the section "power" of the laptop works very well: if I plug the power, the 'dc in' and 'battery' LED will light,
-
Steps to access & replace HDD in Satellite A660
Can someone refer me to the online instructions in accessing and/or replacing the HARD drive in the Toshiba Satellite A660? I was not able to find this info on the web.Thank you.
-
connectors showing vertically on the standard connector pane
Anyone know why my terminals of the connector here are the vertical for the cluster?