getting the number of day in quarter Teradata -


i trying day of quarter when give current date.

for example if give 01/25/2012 output should 25. since 25th day of quarter.

similarly if give 02/01/2012 should give 32 output.

i able first day of quarter not able day in quarter.

platform teradata. calendar not have option day_of_quarter looking for. given date, require know number of day of quarter.

please help. thank in advance.

trunc(datecol) returns first day of quarter, date1 - date2 returns number of days between:

select (datecol - trunc(datecol, 'q')) + 1 day_of_quarter 

you might put calculation sql udf or add column existing calendar table.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -