Subject | CTE Spaces between every day |
---|---|
Author | Check_Mail |
Post date | 2019-08-12T09:53:45Z |
Hello,
I have created a CTE in a stored prodedure which gives me all terms of the next days, for example:
01.10.2019 Meeting with..
01.10.2019 Exkursion
02.10.2019 Termin
04.10.2019 Termin XX
Now I would set between every day a blank record, a kind of space.
01.10.2019 Meeting with..
01.10.2019 Exkursion
02.10.2019 Termin
04.10.2019 Termin XX
That I can realize this, I have set a counter, each record, 1,2,3..
Here a part of my procedure:
for with kalT as(
select cast(m.t || '.' || m.m || '.' || m.j as timestamp) as ts, m.bez, m.id, m.zeit, coalesce(w.b,0) - coalesce(w.q,0) as qself
from tkal_main m left join tkal_wek w on m.id = w.main_id
where m.serie = 3 and w.wek_id = :wek_team
… each other..
-- halbjährlich Termin
union all
select cast(p.str as timestamp) as ts, m.bez, m.id, m.zeit, coalesce(w.b,0) - coalesce(w.q,0) as qself from tkal_main m left join tkal_wek w on m.id = w.main_id, p_sub_datum2(:vorschau,1,m.t,m.m,6) p
where m.serie = 6 and w.wek_id = :wek_team -- noch überarbeiten, jährlich, unterfunktion und vorwarnung extra
-- halbjährlich Vorwarnung
union all
select cast(p.str as timestamp) - e.t_before as ts , m.bez || ' Vorwarnung', m.id, m.zeit, coalesce(w.b,0) - coalesce(w.q,0) as qself from tkal_main m left join tkal_wek w on m.id = w.main_id left join tkal_erin e
on m.id = e.main_id, p_sub_datum2(:vorschau,1,m.t,m.m,6) as p where m.serie = 6 and w.wek_id = :wek_team
)
select :ds + 1, ts, bez, id, zeit, qself, s.gverh from kalT, p_sub_datums(id) s where ts >= current_date and ts < current_date + :vorschau order by ts into :ds, :datum, :bez, :ds_id, :zeit, :qs, :gv do
suspend;
Can I select a blank record between the days?
Thank you.