All pastes #929987 Raw Edit

Mine

public text v1 · immutable
·published 2008-03-06 05:20 UTC
rendered paste body
select t.terr_id, max(t.start_date) as start_dat

from zz_sr_territory t

where t.start_date <= getDate() and t.end_date>=getDate()
group by t.terr_id;

----------------------------------------------------

select * from zz_sr_territory s where start_date <= getDate() and end_date>=getDate();