How to get the desired result
hi friends
i have a field having name value in table which when order by a datetime field named change_date give me the result like shown below
a b value
* * 3
* * 5
* * -1
* * 8
* * 13
* * 19
* * 21
* * -1
* * 6
now i want a query that will give result like below
* * -1
* * 8
* * -1
* * 6
means the record having the value field -1 and the next row and then again -1 record and the next immediate record.Plz help
Edited by: dj on Feb 25, 2012 5:36 AM
Maybe
select a,b,value
from (select a,b,value,
row_number() over (order by your_column) rn,
case when lag(value) over (order by your_column) = -1 then 1 end x
from your_table
where value = -1
or x is not null
order by rnRegards
Etbin
Similar Messages
-
How to get the fixed result in a DES/CBC mode with fixed input data and fix
How to get the fixed result in a DES/CBC mode with fixed input data and fixed key. Below is my program , I tried to get the checksum of the DESInputData with the DESKeyData, but each time the result is different.
below is my code:
byte[] DESKeyData = {(byte)0x01 ,(byte)0x01 ,(byte)0x01 ,(byte)0x01, (byte)0x01 ,(byte)0x01 ,(byte)0x01 ,(byte)0x01 };
byte[] DESInputData = {(byte)0x31 ,(byte)0x31 ,(byte)0x31 ,(byte)0x31,(byte)0x31 ,(byte)0x31 ,(byte)0x31 ,(byte)0x31 };
SecretKeySpec skey = new SecretKeySpec( DESKeyData, "DES" );
Cipher cipher = Cipher.getInstance("DES/CBC/NoPadding");
cipher.init( Cipher.ENCRYPT_MODE, skey );
byte[] result = cipher.doFinal( DESInputData );Use class javax.crypto.spec.IvParameterSpec to specify IV for CBC mode cipher:
// Create CBC-mode triple-DES cipher.
Cipher c = Cipher.getInstance("DESede/CBC/PKCS5Padding");
// Specify IV.
IvParameterSpec iv = new IvParameterSpec(new byte[] { (byte)0x01, (byte)0x23, (byte)0x45, (byte)0x67, (byte)0x89, (byte)0xAB, (byte)0xCD, (byte)0xEF });
// Initialize cipher with proper IV.
c.init(Cipher.ENCRYPT_MODE, yourKey, iv);
// Encrypt and decrypt should work ok now.
For more info about cryptography, search the Internet for IntroToCrypto.pdf from mr. Phil Zimmerman. This document is also part of PGP (http://www.pgp.com).
An excellent book is 'Applied Cryptography' from Bruce Schneier (http://www.counterpane.com/applied.html).
Regards,
Ronald Maas -
How to get the query result of improvement (Before and After ) using sql de
how to get the query result of improvement (Before and After ) using sql developer.
Check
http://www.oracle.com/technetwork/articles/sql/exploring-sql-developer-1637307.html -
How to get the full result of a google search?
How to get the full results of a google search?
Nov 23, 2006 2:28 AM
Hi, Friends,
I want to build a URL collector as a seamless and integrated part of my desktop application in java language which can access the full search results of google, but i am not sure the right way? what is the best way to do that in java?
Where to find the relevant materials for the problem?
thanks a lotCross post - http://forum.java.sun.com/thread.jspa?threadID=788627&messageID=4481369#4481369
-
How to get the best results using the refine edge tool?
how to use the sliders in the refine edge tool? how do you get the best results using the fine edge tool?
You should ask in the forum for the (un-named) program you are using
The Cloud forum is not about using individual programs
The Cloud forum is about the Cloud as a delivery & install process
If you will start at the Forums Index https://forums.adobe.com/welcome
You will be able to select a forum for the specific Adobe product(s) you use
Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll -
How to get the Overall result and Avg in Query
Hi
I am facing a problem to find Overall result and Avg for the keyfigure.
Here is the scenario.
I have a fiscalperiod ,qty in query column and material in row, when user enters the fiscalperiod(004.2006 to 006.2006)
the output should come as
0406 0506 0606 Avg
M1 10 20 40 35
M2 20 40 30 45
res 30 60 70
i can able to get the overall result not avg,
if i change the properities of keyfigure 'Calicuate Result as 'Average of all values'',then i am loosing the overall result.
eitherway i can able to get one result,not both.
anybody can help.
Thanks
MadhuYou have 2 key figures and you have put Material in the ROWS.
Remove Material from ROWS and instead use 0FISCYEAR in the row selection.
You can create 12 Key figures for each month and use either Filer or Free Characteristic using 0CALMONTH to restrict the month for the selection Variable.
For the Key Figures use "Calculate Single Value as" Average.
Create another formula as KF1KF2....+KF12 to get the sum of average.
Regs
Gopi
Assign points if it helps... -
How to get the required result in BI publisher?
Hi All,
QuoteROW
QuoteItemROW
SA -- abc
PROD --xyzitem
NR -- 100
MR -- 150
QuoteItemROW
SA -- abc
PROD --xyz
NR -- 100
MR -- 150
QuoteItemROW
SA -- abc
PROD --xyz
NR -- 100
MR -- 150
QuoteItemROW
SA -- abc
PROD --xyzitem
NR -- 100
MR -- 150
QuoteItemROW
SA -- abc
PROD --xyz
NR -- 100
MR -- 150
QuoteItemROW
SA -- abc
PROD --xyz
NR -- 100
MR -- 150
QuoteItemROW
SA -- abc
PROD --klmitem
NR -- 100
MR -- 150
QuoteItemROW
SA -- abc
PROD --xyz
NR -- 100
MR -- 150
QuoteItemROW
SA -- abc
PROD --klm
NR -- 100
MR -- 150
I have to grp on SA, PROD, NR, MR
My Result should be a table
SA ---abc
PROD NR MR count
xyzitem 100 150 2
xyz 100 150 4
klmitem 100 150 1
xyz 100 150 1
klm 100 150 1
Please let me know how to get cnt on child record.
Regards,
SamHi Alex, thank you for your reply.
Yes that is the hierarchy,
QuoteItemROW -------------------------------------> this is the main POFS (master)
SA -- abc
PROD --xyzitem
NR -- 100
MR -- 150
QTY -- 1
QuoteItemROW ----------------------------this is POES under POFS (child)
SA -- abc
PROD --xyz
NR -- 100
MR -- 150
QTY ---- 1
and required a group on SA, then PROD, NR and MR. Basically wanted to display QTY count/sum.
xyz is repeating (in red color) because first xyz is under group of xyzitem and another xyz is under another group of klmitem.
SA ---abc
PROD NR MR QTY
xyzitem 100 150 2
xyz 100 150 4
klmitem 100 150 1
xyz 100 150 1
klm 100 150 1
Regards,
Sam -
How to get the Survey result with a External Provider
Hi all
We have an scenario where we create a Survey and it's executed for a third party, and then they send to us the results for example in a excel sheet.
Some know how we can upload the survey results per each client into CRM,
Best Regards.Go for ELM processing.....create mapping and ELM the file in the system....In the BADI enhancement for processing steps, define the logic for processing the response through an activity....
Create Activity
Attach the questionaire to the Activity...
ELM the file that you received
Process the file filling up answers on the activity questionaire...
Hope it helps...
Thanks
Nikhil -
How to get the entire result into an XMLDocument??
Hello,
I would like to get the result of a DB Query as XMLDocument. Here's the code I use:
ResultSet rset = stmt.executeQuery();
OracleResultSet orset = (OracleResultSet) rset;
while (orset.next()) {
XMLType poxml = XMLType.createXML(orset.getOPAQUE(1));
Document doc = poxml.getDOM();
The problem is, that I can only get a XMLDocument per table row, but not an XMLDocument of the entire result.
Regards,
DominikI got the answer myself:
In the xsql-query, use the xmlagg() function to group the all records into one record.
Use the same Java code.
Regards,
Dominik -
How to get the desired output in the format ...?
Hi all,
I am having data like this.
Col1 col2 col3
1 2 1
1 2 2
1 2 3
2 3 7
2 3 8
2 3 9
I want to output the data like this
1 2 1,2,3
2 3 7,8,9
How to get this.
Thanks in advance,
PalIn simple sql...
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from t
2 /
COL1 COL2 COL3
1 2 1
1 2 2
1 2 3
2 3 7
2 3 8
2 3 9
6 rows selected.
SQL> select max(decode(rno,1,to_number(col1||col2||col3))) col1, max(decode(rno,2,col3)) col2, max(decode(rno,3,col3)) col3
2 from (select row_number() over(partition by col1,col2 order by col3) rno, t.*
3 from t)
4 group by col1
5 /
COL1 COL2 COL3
121 2 3
237 8 9
SQL>Thanks,
Karthick. -
SQL Query to get the desired result
Can someone give the SQL to get this output.
input is like this in table.
cola colb fromdate todate
1 100 1/5/2010 1/9/2010
1 101 1/10/2010 1/25/2010
1 102 1/26/2010 12/31/2900
2 201 3/1/2011 3/10/2011
2 202 3/11/2011 12/31/2900
3 301 1/5/2010 1/9/2010
3 302 1/10/2010 1/25/2010
3 303 1/26/2010 1/28/2010
3 304 1/29/2010 12/31/2900
I want to get the output like this.
cola colb fromdate todate
1 100 1/5/2010 1/9/2010
2 201 3/1/2011 3/10/2011
3 301 1/5/2010 1/9/2010
More info:
I want to get the rows where fromdate is the min(fromdate) from each cola's unique values i.e. 1,2,3
Please let me know the SQL.
Thanks.
[email protected]This way!!!
with data(cola, colb, st_dt, ed_dt) as
select 1, 100, to_date('01/05/2010', 'MM/DD/YYYY'), to_date('01/09/2010', 'MM/DD/YYYY') from dual union all
select 1, 101, to_date('01/10/2010', 'MM/DD/YYYY'), to_date('01/25/2010', 'MM/DD/YYYY') from dual union all
select 1, 102, to_date('01/26/2010', 'MM/DD/YYYY'), to_date('12/31/2900', 'MM/DD/YYYY') from dual union all
select 2, 201, to_date('03/01/2011', 'MM/DD/YYYY'), to_date('03/10/2011', 'MM/DD/YYYY') from dual union all
select 2, 202, to_date('03/11/2011', 'MM/DD/YYYY'), to_date('12/31/2900', 'MM/DD/YYYY') from dual union all
select 3, 301, to_date('01/05/2010', 'MM/DD/YYYY'), to_date('01/09/2010', 'MM/DD/YYYY') from dual union all
select 3, 302, to_date('01/10/2010', 'MM/DD/YYYY'), to_date('01/25/2010', 'MM/DD/YYYY') from dual union all
select 3, 303, to_date('01/26/2010', 'MM/DD/YYYY'), to_date('01/28/2010', 'MM/DD/YYYY') from dual union all
select 3, 304, to_date('01/29/2010', 'MM/DD/YYYY'), to_date('12/31/2900', 'MM/DD/YYYY') from dual
select cola, colb, st_dt, ed_dt
from (
select cola, colb, st_dt, ed_dt,
row_number() over (partition by cola order by st_dt) rn
from data
) a
where a.rn = 1;
COLA COLB ST_DT ED_DT
1 100 05-JAN-10 09-JAN-10
2 201 01-MAR-11 10-MAR-11
3 301 05-JAN-10 09-JAN-10 -
How to get the desired total of Random numbers ?
I m in a big problem and want a urgent solution.
I want to randomise numbers with specified limit and the total of all the randomised numbers should be desirable.
e.g. if i m generating random number 24 times in a loop then the total of all the gerenrated numbers should be 100 and each randomised generated number should not be greater than 6.
Please help me out. is there any method from which i can get, desirable total from the gererated random numbers ?
Please help.
thanks in advanceIn my usual manner, I'll throw in a couple of ideas and leave others to discard them again :-)
Pick random numbers. If, at some point, the sum goes over 100, throw away the last number at instead put in the number that will make the sum exactly 100. Then put in 0 until you have 24 numbers. Those 0s won't look random. If it helps, shuffle all the numbers so the 0 come in random places in the sequence. If it's still not random enough, discard the whole idea. If, on the other hand, you still are m numbers short of 24 numbers and the sum goes under 100 - (m * 6), in a similar manner stop using randomness and throw in the numbers needed to hit 100. Shuffle to distribute the 6s.
Another idea, there are 100 ^ 24 or 10 ^ 48 ways to put 100 balls into 24 buckets. Find out how many ways there are under the constraint that you can put at most 6 balls into a bucket. Enumerate them, pick one at random and generate it. I would say that this should give you a good randomness, but does it also look that way under your requirements? -
Query: Not getting the desired result. Please help
QL> select * from ecev;
entity_Tag
7
8
9
10
1
2
3
4
5
6
SQL> select * from dg;
DIGP_TAG CEPT_TAG
600 1
700 1
800 1
900 1
100 1
200 1
500 1
75 2
SQL> select * from enow;
ENTITY_CODE ENTITY_TAG DIGP_TAG TARGET_DA CEPT_TAG
EXT 7 600 26-MAY-07 1
EXT 8 700 26-MAY-07 1
EXT 9 800 26-MAY-07 1
EXT 10 800 22-APR-76 1
EXT 1 100 20-OCT-06 1
EXT 2 200 20-OCT-06 1
EXT 3 500 20-OCT-06 1
EXT 4 100 20-OCT-06 1
EXT 5 100 20-OCT-06 1
EXT 6 80 20-OCT-06 1
EXT 1 75 2
SQL> select * from tk;
TK_TAG DIGP_TAG NARRATIVE DUE_DATE CEPT_TAG
35 90 raj 27-MAY-07 1
36 900 kkd 27-MAY-07 1
37 100 kim 28-MAY-07 1
30 100 ram 23-MAY-07 1
31 100 kish 23-MAY-07 1
32 200 mar 23-MAY-07 1
33 100 gy 23-MAY-07 1
34 100 mm 27-MAY-07 1
8 rows selected.
For the following query
1 select
2 d.ecev_tag ecev_tag,
3 a.digp_tag entity_owner ,
4 c.digp_tag task_owner,
5 c.tk_tag task_tag,
6 c.narrative
7 from enow a,
8 entl b,
9 tk c,
10 ecev d
11 where ( a.DIGP_TAG=100 or c.digp_tag=100)
12 and a.entity_tag=b.entity_tag(+)
13 and b.tk_tag=c.tk_tag(+)
14* and a.entity_tag=d.entity_tag
SQL> select * from entl;
TK_TAG ENTITY_TAG
35 5
36 10
30 1
31 1
32 2
33 3
34 3
Result:
I get
entity_tag ENTITY_OWNER TASK_OWNER TASK_TAG NARRATIVE
5 100 90 35 raj row1
1 100 100 30 ram row2
1 75 100 30 ram row3 1 100 100 31 kish row4
1 75 100 31 kish row5 3 500 100 33 gy row6
3 500 100 34 mm row7
4 100 row8
Row1: yes, since entity_tag 5 is owned by digp_tag 100 (enow)
Row2: yes, since entity_tag 1 is owned by digp_tag 100 (enow)
Row3: NO, since entity_tag 1 is owned by digp_tag 75, which in turn is in cept_tag 2, since the passed digp_tag is 100 and it just belongs to cept_tag 1 we should not be getting this row.
Row4: Yes, since tk_tag 31 is owned by digp_tag 100 (tk)
Row5 NO, since entity_tag 1 is owned by digp_tag 75, which in turn is in cept_tag 2 since the passed digp_tag is 100 and it just belongs to cept_tag 1 we should not be getting this row.
Row6: Yes, since tk_tag 33 is owned by digp_tag 100 (enow)
Row7: Yes, since tk_tag 34 is owned by digp_tag 100(enow)
Row8: Yes, since entity_tag 4 is owned by 100(enow
I guess i have to join dg.cept_tag and a.cept_tag, but it is not working.....
Can somebody understand this and help...
Thanks
RamQL> select * from ecev;
entity_Tag
7
8
9
0
1
2
3
4
5
6
SQL> select * from dg;
DIGP_TAG CEPT_TAG
600 1
700 1
800 1
900 1
100 1
200 1
500 1
75 2
SQL> select * from enow;
ENTITY_CODE ENTITY_TAG DIGP_TAG
TARGET_DA CEPT_TAG
EXT 7
600 26-MAY-07 1
8 700
26-MAY-07 1
EXT 9
800 26-MAY-07 1
10 800
22-APR-76 1
EXT 1
100 20-OCT-06 1
2 200
20-OCT-06 1
EXT 3
500 20-OCT-06 1
4 100
20-OCT-06 1
EXT 5
100 20-OCT-06 1
6 80
20-OCT-06 1
EXT 1
75 2
L> select * from tk;
TK_TAG DIGP_TAG NARRATIVE DUE_DATE
CEPT_TAG
35 90 raj 27-MAY-07 1
36 900 kkd 27-MAY-07 1
37 100 kim 28-MAY-07 1
30 100 ram 23-MAY-07 1
31 100 kish 23-MAY-07 1
32 200 mar 23-MAY-07 1
33 100 gy 23-MAY-07 1
34 100 mm 27-MAY-07 1
8 rows selected.
For the following query
1 select
2 d.ecev_tag ecev_tag,
3 a.digp_tag entity_owner ,
4 c.digp_tag task_owner,
5 c.tk_tag task_tag,
6 c.narrative
7 from enow a,
8 entl b,
9 tk c,
10 ecev d
11 where ( a.DIGP_TAG=100 or c.digp_tag=100)
12 and a.entity_tag=b.entity_tag(+)
13 and b.tk_tag=c.tk_tag(+)
14* and a.entity_tag=d.entity_tag
SQL> select * from entl;
TK_TAG ENTITY_TAG
35 5
36 10
30 1
31 1
32 2
33 3
34 3
sult:
I get
entity_tag ENTITY_OWNER TASK_OWNER TASK_TAG
NARRATIVE
5 100 90
35 raj row1
100 100 30
ram row2
75 100
30 ram row31 100 100
31 kish row4
75 100
31 kish row5
3 500 100
33 gy row6
500 100 34
mm row7
100 row8
1: yes, since entity_tag 5 is owned by digp_tag 100
(enow)
Row2: yes, since entity_tag 1 is owned by digp_tag
100 (enow)
Row3: NO, since entity_tag 1 is owned by digp_tag 75,
which in turn is in cept_tag 2, since the passed
digp_tag is 100 and it just belongs to cept_tag 1 we
should not be getting this row.
Row4: Yes, since tk_tag 31 is owned by digp_tag 100
(tk)
Row5 NO, since entity_tag 1 is owned by digp_tag 75,
which in turn is in cept_tag 2 since the passed
digp_tag is 100 and it just belongs to cept_tag 1 we
should not be getting this row.
Row6: Yes, since tk_tag 33 is owned by digp_tag 100
(enow)
Row7: Yes, since tk_tag 34 is owned by digp_tag
100(enow)
Row8: Yes, since entity_tag 4 is owned by 100(enow
I guess i have to join dg.cept_tag and a.cept_tag,
but it is not working.....
Can somebody understand this and help...
Thanks
Ram
Result:
I get
entity_tag ENTITY_OWNER TASK_OWNER TASK_TAG NARRATIVE
5 100 90 35 raj row1
1 100 100 30 ram row2
1 75 100 30 ram row3
1 100 100 31 kish row4
1 75 100 31 kish row5
3 500 100 33 gy row6
3 500 100 34 mm row7
4 100 row8 -
How to get the query result !
Experts !
i am working on a query. in this query i have a sales for a sales person for a month, and in the 2nd coulmn sales for the previous month. there is a 3rd column which gives (% change ). now i have to show only those records where (% change ) is more / less 34%. how do i get those ? Exceptions ??
If by using exceptions, then the 3rd column ( % change) is a formula column ( Not the key figure) . can i use exceptions on Formula column ?
Please helpHI ,
You can try this by creating a condition ,
Create a new condition, in keyfigure you can choose the formula for %, choose the operator as Greater than , in values give 34
Regards,
Sathya -
How to get the correct result when I access mxml file in address bar in IE?
os: windows xp
web server: tomcat 5.5
lcds version: 2.6
One week ago, I installed lcds2.5 in my coumputer. At that time, when I type address http://localhost/lcds/test.mxml in address bar of Internet Explorer, the web server return the result of test.swf.
I upgraded lcds from 2.5 to 2.6 this morning, and then when I type http://localhost/lcds/test.mxml in IE address bar again, the server return the source code of text.mxml in the web page, which is not I expected.
Why the web server don't handle the *.mxml file like in lcds2.5? How can I resolve this problem?Hi,
Webtier Compiler is which is no longer part of LCDS starting with the version 2.6. However you can install it if you want, read the instructions from this link http://labs.adobe.com/wiki/index.php/LiveCycle_Data_Services:Setting_up_an_SDK,_Compilers ,_and_Flex_Builder
Maybe you are looking for
-
Calling a report from another report
Hi, Is there any way ,(any built in ) to call a report from another report in Report Builder 2000 and Report Builder 6i. Regards
-
Problem to install SAP R/3 4.6 on Windows server entreprise 2003
Hello all, I've a problem to install SAP R/3 on a windows enterprise server 2003. This is the step I made : 1) Install Windows enterprise server 2003 2) Add IPX and Netbios to the network (adress ip 192.168.10.2) 3) Add 192.168.10.2 srv1 SAPTRANHOST
-
I Photo 9.1.5 won't open on Macosx 10.6.8
It just keeps spinning and never opens. Does anyone know how this can be fixed? I do have a backup drive but have never used it and don't know how. thanks ann
-
while updating itunes, system gives message that bonjour.msi not found.
-
OK post all your 2.0 problems here!
Here are the list of my problems:- 1) App store is good but crashes all so often. 2) Youtube app cannot connect to net when my safari app is browsing with breeze. 3) Music app does not have recently played to recently added playlists. 4) When syncing