MySQL Forums
Forum List  »  MySQL for Visual Studio

days between differant transaction
Posted by: Lars Warvik
Date: March 08, 2017 07:20AM

Hi ,

I'm new to MySQL and I need som guiding to a question. I have a table with the following columns certificate`.`ID`,
`certificate`.`SIGNED_DATE`,
`certificate`.`VALID_FROM_DATE`,
`certificate`.`VALID_TO_DATE`ยด

SELECT `certificate`.`ID`,

`certificate`.`SIGNED_DATE`,

`certificate`.`VALID_FROM_DATE`,

`certificate`.`VALID_TO_DATE` FROM `intyg`.`certificate`
1 2015-01-26 00:00:00 2015-01-26 2015-01-29
320 2015-02-02 00:00:00 2015-02-02 2015-02-08
465 2015-02-09 00:00:00 2015-02-09 2015-02-15

I would like to create a new column 'Days to next contact' which is
Days_to_next
1 2015-01-26 00:00:00 2015-01-26 2015-01-29 4
320 2015-02-02 00:00:00 2015-02-02 2015-02-08 1
465 2015-02-09 00:00:00 2015-02-09 2015-02-15

Calculation for i.e ID = 320 is 2015-02-08 (valid_to_Date) to 2015-02-09 Valid_from_date) for the next contact (465) = 1 day

Is this possible?

Options: ReplyQuote


Subject
Views
Written By
Posted
days between differant transaction
255
March 08, 2017 07:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.