How to get time diff between two rows ???
I need to calculate the time difference of rows based on a column's value how do i do that ??
say i have a table statistics
id timing
100 10-JAN-07 09.52.10.000000 AM
200 10-JAN-07 09.59.10.000000 AM
300 10-JAN-07 09.59.30.000000 AM
I want to get the time taken by 200 ie timing of 200 - timing of 100
how do i get that .
similarly for id 300 and so on .
regards
Shub
SQL> create table mytable
2 as
3 select 100 id, to_timestamp('10-JAN-07 09.52.10.000000 AM','DD-MON-RR HH:MI:SS:FF AM') timing from dual union all
4 select 200 , to_timestamp('10-JAN-07 09.59.10.000000 AM','DD-MON-RR HH:MI:SS:FF AM') from dual union all
5 select 300 , to_timestamp('10-JAN-07 09.59.30.000000 AM','DD-MON-RR HH:MI:SS:FF AM') from dual
6 /
Tabel is aangemaakt.
SQL> select id
2 , timing
3 , timing - lag(timing) over (order by timing) diff
4 from mytable
5 /
ID TIMING DIFF
100 10-01-07 09:52:10,000000000
200 10-01-07 09:59:10,000000000 +000000000 00:07:00.000000000
300 10-01-07 09:59:30,000000000 +000000000 00:00:20.000000000
3 rijen zijn geselecteerd.Regards,
Rob.
Similar Messages
-
How to get time diff between to date
Hi all,
How can I get the time diff. between two date in a single query
as in the example below-
select
to_char(sysdate,'dd-mm-yyyy hh:mi:ss') d1,
to_char(sysdate-45,'dd-mm-yyyy hh:mi:ss') d2,
months_between(sysdate,(sysdate-45)) mon_diff
/* how can I get the time diff in terms of hour ,min, seconds*/
from dual314214, The difference between any two Oracle dates is measured in Days and fractions thereof.
A day = 24 hrs, = 1440 minutes, = 86400 seconds
Use the mod function on the difference
HTH -- Mark D Powell -- -
How to get the diff between two dates - # of days
Hi Experts,
I have requirement to know the difference between dates. In my presentation layer two columns as created date and updated date. I want to know the difference in # of days in the presentation services.
Please provide some pointers.
Thanks in adv
svrHi,
In the presentation layer you can create a column with a custom formula of this:
TIMESTAMPDIFF(SQL_TSI_DAY, datecolumn1,datecolumn2)
The result shown in the column will be the difference in days between the two dates.
Regards,
Matt -
How to get lines in between two fields in smartform
Dear Freinds,
I have developed one smart form however iam not getting output correct could you please help me out, the problem iam getting is iam not able to get the following things
in The Main Window
i have one header , one Main Area and one Footer Area
in the header i have created one %ROW1 and named as Row and again under the ROW i have
created a % Cell ...........again i want to create for the same Row iam not able to creeate another
Cell.........please let me know how i can have 5 or 6 cells for the same Row .
as i want the output as
UNit No. : 103 Quantity Req : 200 Date of Issue : 10/01/2008
Destination : Delhi Amount : 300 Rate/Per unit : 7
and secondly i have to have lines between the rows .... so please do let how to get lines in between rows as well..
i have tried allot but not able to get.
regds
madhuriHi Marcin Pciak ,
Thank you very much for giving me the solution, one more point i require in this regard
i have requirement as below
IDNo Invoice Amount
Despatch Date Despath Time.
Now i want i created Two Cell s (Cell A & Cell B) could you let me know how i can get IDNO and
Invoice Amount adjusacent to each other as above but right now iam getting in my smarform
IDNO
Invoice amount
but i want is IDNO-- Invoice Amount--
please help me this point
thanks once again for giving me answer.
regards
madhuri -
How to get the difference between two columns in a column group
Hi All,
My first time here and really new to programming. I would like to get the difference between 2 columns that are inside
a column group.
Here is my sample table below: The Column Group is PeriodNumber and can only choose 2. like 1 and 2.. I would like to have a third row which will simply calculate the difference between the amounts in PeriodNumber 1 and 2.
PeriodNumber
Account 1 2
1) Cash 10,000 15,000
2) Receivables 12,000 11,500
3) Equipment 5,000 5,500
Total Assets 27,000 32,000Hi yabgestopa,
From your description, you want to get the difference between two columns in a column group. After testing it in my environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
Dim Shared Num1 As Integer
Dim shared Num2 As Integer
Public Function GetAmount(Amount as Integer, Type as String)
If Type = "1" Then
Num1=Amount
Else
Num2=Amount
End If
Return Amount
End Function
Public Function GetDif()
Return Num1-Num2
End function
Right-click the second column to insert a third column with Outside Group-Right.
Then use the expressions below in the matrix.
=Code.GetAmount(Fields!Amount.Value,Fields!PeriodNumber.Value)
=code.GetAmount(Sum(Fields!Amount.Value),Fields!PeriodNumber.Value)
=Code.GetDif()
The report looks like below.
If you have any questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
How to measure time difference between two continous encoder pulse (PULSE A & PULSE B)
im trying to figure out the time difference between two square
wave pulse (PULSE A and PULSE B) from an encoder. I tried to modify many code but fail to capture thephase difference for each pulse. the
pulse only rise to 5V and fall to 0V like normal square wave pulse
can you and all of experts here help me out with this?
my problem
1) Encoder pulse are continous (pulse A and pulse B)
2) Square wave pulse have "0V" and "5V" please rapidly
if possible someone show me correct method , Im using LABVIEW 7.1 and Hardware NI SCOPE (PCI 5102)
your advice are highly appreciated
among my idea as in attachment , but I failed to get it
Attachments:
Need to Get this wave.JPG 34 KBHi Amirul,
Check the attached JPG file. i think this will be use full to you
Regards,
Santhosh M -
How to get the difference between two HashMaps
i have two HashMaps
HashMap first = new HashMap<Integer,Object>();
HashMap second = new HashMap<Integer,Object>();
How to get the difference between one and two and put the result in the third
HashMap third = new HashMap<Integer,Object>();My bad, difference of course means removeAll():Map<Integer,Object> first = new HashMap<Integer,Object>();
Map<Integer,Object> second = new HashMap<Integer,Object>();
Map<Integer,Object> third = new HashMap<Integer, Object>(first);
third.keySet().removeAll(second.keySet());No loops needed. -
How to get percentage difference between two matrices?
Good day everyone, I just want to ask how to get the percentage difference between two binary matrices. This is for comparing two images converted to matrices in LabView. Thank you.
Solved!
Go to Solution.pinkman wrote:
Good day everyone, I just want to ask how to get the percentage difference between two binary matrices. This is for comparing two images converted to matrices in LabView. Thank you.
You probably converted it to a 2D array (A matrix in LabVIEW has a special meaning).
"Binary" is not very well defined (unless you are looking for the number of bits that are different). What is the datatype? Was it a color image or a greyscale image? Are both arrays the same size?
How do you define "percentage difference"? Which one of the two is the 100% reference?
Do you want a new 2D array where each element is the difference of the second array compared to the first (or vice versa), expressed in percentages?
Do you want to know what percentage of array elements are different between the two arrays?
Do you want to know the average difference between all array elements?
All possible interpretations can be easily solved with very little code, but you need to explain in more detail what you actually want?
Here is a simple solution for case #2, for example (assuming the array have the same size, and we only want a rought estimate, rounded down to the nearest integer percent):
LabVIEW Champion . Do more with less code and in less time .
Attachments:
PCT-Difference.png 16 KB -
How to get the difference between two date
Hello,
I want to know how to write a code the tell me the difference between two date, I am using
oracle.jbo.domain.Date
i have a rent date and return date so my code is
Date rent=(Date)nr.getAttrbute("RentDate"),ret=(Date)nr.getAttrbute("ReturnDate");
is there a way to know the difference in days between those two dates ?
Thankshi,
try this.....
DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
Date date = (Date)formatter.parse(dateStr); //// dateStr <- from date value (that is string value)
Date dateto = (Date)formatter.parse(datetostr); //// datetostr <- to date value (to date getting from as a string)
Calendar cal = Calendar.getInstance();
cal.setTime(date);
Calendar calto = Calendar.getInstance();
calto.setTime(dateto);
fromDate = cal.get(Calendar.DATE) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR);
toDate = calto.get(Calendar.DATE) + "/" + (calto.get(Calendar.MONTH) + 1) + "/" + calto.get(Calendar.YEAR);
// System.out.println("from Date : " + fromDate);
if ((fromDate != null && toDate != null) && (date.compareTo(dateto) > -1) ) {
fc.addMessage("VacationQueryComponent", new FacesMessage(FacesMessage.SEVERITY_ERROR, "From Date cannot be lower than To Date", "From Date cannot be lower than To Date"));
fc.renderResponse();
thks. -
How to get total amount between two fiscal years
i Have a report requirement. I have created a crosstab report where I need to get amount of current year current month(10/2010), current year last month(09/2010),last year last month(10/2009). Here I'm comparing 10/2010 amount with 09/2010 and 10/2009. But now my manager asking to me create report that compare amount between 2008 and 2009 periods.
How to get that?
I have a prompts and I entered 1)fiscal year=2009
2)fiscal period= 9;10
3) account numbers=x;y;z;p;q;r;s
I entered fiscal year:2009 in the prompt but I need to compare fiscal year 2009(i.e 10/2009) amount with fiscal year 2008(10/2008).
2009/09 2009/10 2008/10
Account number account name amount amount amount
In advance,Thanks for your responseIs your universe based on a BEx query? If so, create the offset variables in the BEx query.
If the universe is not based on a BEx query, you will need to create these variables in your universe. I do not believe you can do this directly in Webi. -
How to improve time interval between two measurments
Hi All..
I have 3 Vi each of one measures from different devices. And i set the execution order by error cluster. I wonder what is duration between of each of execution? if you look at the VI that i attach, u see that 3 (one of which is seen as question mark) are connected serially, but the problem is that there is a delay between measurements that i can distinguish just looking data values acquisation(then should be really high). How can i improve time interval between measurements? I need to measure 3 output when the conditions are the same for all, but when there s delay the condition of device 1 and 3 could be different and effecting my project.
Attachments:
measurement.vi 91 KBHello,
>> I wonder what is duration between of each of execution?
You can use the tick count function and a sequence structure (not usually recommended, but ok for debug purposes like this).
>> How can i improve time interval between measurements?
It sounds like you want your 3 measurements to be relatively independent, but to all be triggered by the same event. How about setting up a loop for each measurement - using an event structure in those acquisition loops - and then monitoring your "trigger condition" in a 4th independent loop, which will trigger a user event to cause the other loops to execute accordingly.
If you are eventually going to scale things further, you may explore other architectures instead of simply creating more loops.
If you can clarify what you're trying to do here, we can probably help you further!
Best Regards,
JLS
Best,
JLS
Sixclear -
How to get a text between two XML tags?
Hello everybody!
I've got a problem! How can I extract a text that is between tags, like <myTag> My text </myTag> I have no problem to get the attributes inside the tags, however, i don't know how to get some text that is between tags. Here is my xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<tangram_request service_id="3">
<send keep_session="nada">
<source></source>
<destination>3196931566</destination>
<channel_id>2</channel_id>
<text>Teste ServerSocket!!!</text>
</send>
</tangram_request>
Now, there's a fragment of my code, which gets some tags' attributes:
DOMParser parser = new DOMParser();
InputSource resp = new InputSource(new StringReader(XML));
parser.parse(resp);
Document doc = parser.getDocument();
Node node =(doc.getElementsByTagName "tangram_request")).item(0);
if (node instanceof Element)
Element el = (Element) node;
service_id = el.getAttribute("service_id");
System.out.println("\n\nService_id="+service_id);
}else{System.out.println("Erro");}
node = (doc.getElementsByTagName("send")).item(0);
if (node instanceof Element)
Element el = (Element) node;
keep_session = el.getAttribute("keep_session");
System.out.println("keep_session="+keep_session);
}else{System.out.println("Erro");}
Now, I want to get the texte between <destination> ... </destination>
How could I do that?
Thanks a lot
CalegariThanks... It worked fine!!!
Now how can I get lots of <desctination>... I did something that haven't worked...
node = (doc.getElementsByTagName("destination")).item(0);
while(node.hasChildNodes())
destination = node.removeChild(node.getFirstChild()).getNodeValue();
System.out.println("destination="+destination);
And now, my XML is like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<tangram_request service_id="3">
<send keep_session="nada">
<source></source>
<destination>3196931566</destination>
<destination>3196931567</destination>
<channel_id>2</channel_id>
<text>Teste ServerSocket!!!</text>
</send>
</tangram_request>
Thanks so much!
Calegari -
How to get the data between two dates?
Hi all,
I am facing a problem of getting the data betwwen two dates.
I have written a query as
"select * from table1 a where a.dt between trunc(sysdate) and trunc(sysdate)-30"
It is not showing any errors or warnings.But the data is not coming though the data is in the table1 between these two dates.
Regards,
KumarYour ordering is probably wrong:
SELECT *
FROM table1 a
WHERE a.dt BETWEEN TRUNC (SYSDATE) - 30 AND TRUNC (SYSDATE) -
How to get the difference between two BufferedImages?
All the BufferedImage which is grabbed from AWT may be same each other,
i only want to get the different part of two continuous BufferedImages and send ti over internet.
I have compared two BufferedImages by RGB (int[]), but this process wastes 400~500ms,it's terrible,:)
who has any good idea about this?
thanks
Best Wishes
mauvespanthanks ! cary ,
I have a list contained some BufferedImages gotten from AWT component,and then these images
will be transfered to client and displayed in Internet explore ,actually there are only some difference
between two continuous BufferedImages,i don't want to transfer the WHOLE image to client,SO i
want to handler every image before sending to client , at last, the different part will only be sent to client.
All these ideas will be contained this method:
* Compare the specified two BufferedImages and return the different part between them.
* @param ref the specified first image
* @param gen the specified sencond image
* @return the different part between the specified two images.
public static void BufferedImage compareBufferedImage(BufferedImage ref,BufferedImage gen){
to finish this method ,do you have any good ideas?or sample code?
thanks
Best wishes
mauvespan -
How to get the dates between Two dates excluding Saturaday and Sunday
Dear All,
select to_date('25-04-2012', 'DD-MM-YYYY') + rownum -1 dt
from dual
connect by level <= to_date('05-05-2012', 'DD-MM-YYYY') - to_date('25-04-2012', 'DD-MM-YYYY') + 1;The above query returning the following output,
DT
DT
04/25/2012
04/26/2012
04/27/2012
04/28/2012
04/29/2012
04/30/2012
05/01/2012
05/02/2012
05/03/2012
05/04/2012
05/05/2012here I need to exclude the Dates which comes on 'saturday' and 'sunday' and also the common holiday
Here it is '01-May-2012' and I need the output like the following,
04/25/2012
04/26/2012
04/27/2012
04/30/2012
05/02/2012
05/03/2012
05/04/2012I need the common query to calculate between any two dates.
Can anyone suggest me?
Thank you,
Regsrds,
gurujothiHi Frank,
Sorry for my fault,
The following is my table description,
CREATE TABLE "DATES"
( "FROMDATE" DATE,
"TODATE" DATE,
"LEAVE_ID" Number(5)
Insert into dates values('05-02-2012','05-05-2012',1);
Create table holiday_dates(holidays date);
insert into holiday_dates values('01-05-2012');Now when I used this query,
select count(*) from (select dt
from(
select to_date(fromdate, 'DD-MM-YYYY') + rownum -1 dt
from dates
connect by level <= to_date(todate, 'DD-MM-YYYY') - to_date(fromdate, 'DD-MM-YYYY') + 1
where to_char(dt,'fmday') not in ('sunday','saturday') minus (select holidays from holiday_dates)) dual;
Count(*)
64
Insert into dates values('01/05/2012','05/05/2012',2);
/Now my table has 2 rows,
select * from dates;
FROMDATE TODATE LEAVE_ID
01/05/2012 05/05/2012 1
05/02/2012 05/05/2012 2Now when I used this query,
select count(*) from (select dt
from(
select to_date(fromdate, 'DD-MM-YYYY') + rownum -1 dt
from dates
connect by level <= to_date(todate, 'DD-MM-YYYY') - to_date(fromdate, 'DD-MM-YYYY') + 1
where to_char(dt,'fmday') not in ('sunday','saturday') minus (select holidays from holiday_dates)) dual;The output is ,
COUNT(*)
1987How to get the output using the max(leave_id) like the following,
select..........from... where leave_id=(select max(leave_id) from dates);where to add "WHERE" clause in the above query?
Thank you,
Regards,
Gurujothi.
Edited by: Gurujothi on May 3, 2012 8:43 PM
Edited by: Gurujothi on May 3, 2012 8:44 PM
Maybe you are looking for
-
I want to sync my iPad with a new laptop, so I can get rid of the old computer. I have already downloaded all the itunes content on the new laptop, but when i go to sync, it tells me that itunes will erase and copy all the apps from the new library.
-
Message Driven Bean (MDB) for AQ Queue cannot start
I am working on the creating a message driven bean in Managed OC4J 10.1.3.0 to consume messages from AQ Queue. I am using a Oracle AS generic JMS connector and a resource adapter to create a message listener for the MDB. I am able to make successful
-
Daughter changed the pass code on the lock screen and does not remember it; how do i fix a lost pass code?
-
Navigating among user interfaces
I want to ask how do we use HTML style hyperlinks in Swing to support navigation from one user interface to another within the same application. Please give some code sample if possible. Thanks.
-
Help With DVD Recorder Purchase
I would like to purchase a DVD recorder that is fully compatible with IMovie. Can any one please suggest a brand that they have liked. There are lots of recorders that now say they are compatible, but I have my doubts. Any assistnace would be greatel