SELECT b.institution , a.crse_id , a.effdt , c.language_cd , c.descr FROM ps_crse_catalog a , PS_CRSE_OFFER b , ps_crse_catlg_lng c WHERE a.crse_id = b.crse_id AND a.effdt = b.effdt AND a.crse_id = c.crse_id and a.effdt = c.effdt AND b.course_approved = 'A' AND (a.effdt = ( SELECT MAX(a1.effdt) FROM ps_crse_catalog a1 WHERE a.crse_id = a1.crse_id AND a1.effdt <= %CurrentDateIn) OR (a.effdt > %CurrentDateIn AND NOT EXISTS ( SELECT 'X' FROM PS_CRSE_CATALOG a2 WHERE a.crse_id = a2.crse_id AND a2.effdt <= %CurrentDateIn)) AND a.effdt = ( SELECT MIN(a3.effdt) FROM ps_crse_catalog a3 WHERE a.crse_id = a3.crse_id AND a3.effdt > %CurrentDateIn))
|