Skip to content

How to SUM multiple DECODE values?

I have the following decodes in my SELECT case: DECODE (table_name, ‘RECHNUNG’, SUM(beleg_betrag_offen) ) as re_be_of, DECODE (table_name, ‘GUTSCHRIFT’, SUM(beleg_betrag_offen) ) as gs_be_of, DECODE (…

Replace text from VIEW Definition

I have the following VIEW definition: create view v_1 as select * from t1 where [date] between ‘2010-01-01’ and ‘2019-01-01’ union all select * from t2 where [date] between ‘2012-01-01’ and ‘2019-01-…

GetDate Function

I have a stored procedure that runs once a month for the whole previous year. So for example 5-1-18 to 5-1-19. I am going to create a job that fires it off at the first of each month. I need my stored …