I have already the date difference between 'Start date' and 'End date' but I also want to calculate the date 10 days after the "End date" in a table.
The first line is OK but when I add the second one the result in column 'End date plus 2 weeks' says Invalid date. It also duplicates the rows.
SELECT *, DATEDIFF(day,'Start date','End date')+ " days" as 'Duration' from T1 UNION
SELECT *, DATE_ADD(DAY, 10, "End date") AS 'End date plus 2 weeks' from T1
How can I fix this?
I reproduced your usw case and this query works for me:
SELECT *, DATEDIFF(day,'Start date','End date')+ " days" as 'Duration',
FORMATDATE('End date' + "240h") AS 'End date plus 2 weeks' FROM T1
Also, you can use "10d" instead of "240h", but make sure 1 day is set to 24 hours in the settings (by default it is set to 8 working hours).
Go “behind the screen” to meet some of the Confluence Cloud team. In this video series, we tackle some of the hard-hitting questions you never knew you wanted the answer to! Meet some of the ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events