I am new to the forum and I looked for similar topic but no luck.
I am using webi xi and i want to create a query that will allow me to retrieve the previous working day (therefore excluding Saturday/sunday). so far I got this written:
Select
trunc(sysdate)
Case
when (trunc(sysdate) - trunc(sysdate, ‘IW’)) in (0,5,6)
Then (trunc(sysdate - 1, ‘IW’) + 4)
Else trunc(sysdate - 1)
end
From databasexxx
This code when I run it gives me today’s date and not 8th September 15.
The format of the date in my database is DD/MM/YYYY 12:00:00 Am
Thanks Abiltd for your prompt answer but I literally past this query and got an error message saying :" The Sql query has 1 instead of 3 columns. (Wis 10810)"
What database are you using and where are you testing the query? I wrote that script in Oracle SQL developer and it works fine (otherwise I wouldn`t have posted it!).
I would like to list all the dates within the current quarter(quarter to date) so something like that (as we are in Q3 2015):
01/07/2015
02/07/2015
03/07/2015
etc … up to 07/09/2015 (which is yesterday data because it is the latest data available). If I run it tomorrow then i will have 01/07/2015 up to 08/09/2015.
-same as above but on the year to date basis (from 01/01/2015 up to 07/09/2015.
select TRUNC(sysdate+1, ‘Q’) StartOfCurQuarter,TRUNC(ADD_MONTHS(sysdate, +3), ‘Q’)-1 EndOfCurQuarter from dual
For current year, can`t you just get the
Current Year start and end.
select TRUNC(sysdate,‘Y’) StartOfThisYear, sysdate from dual
I would do some research around the Oracle Trunc function, it`s overloaded so does a ton of different things depending on the types and parameters passed.
Problem is that i want one single column listing all the dates between
stert of current quarter and end of current quarter.
I am certainly missing something here to link the two.
I really am a beginner and surfed a lot on this topic and also my initial query before coming into this forum.