select w.cid,w.position_code,w.position_placment,w.url,w.title,w.ad_text1,w.landing_page,fi.filename,fi.path,dv.start_date,dv.end_date
from wah_ad w
left join file_info fi on fi.some_id = w.wah_id
join deliverable dv on dv.obj_id = w.wah_id
where position_code = 'golden'
and getdate() > start_date
and getdate() < end_date
order by newid()
select w.cid,w.position_code,w.position_placment,w.url,w.title,w.ad_text1,w.landing_page,fi.filename,fi.path,dv.start_date,dv.end_date
from wah_ad w
left join file_info fi on fi.some_id = w.wah_id
join deliverable dv on dv.obj_id = w.wah_id
where position_code = 'featured'
and getdate() > start_date
and getdate() < end_date
order by newid()
select w.cid,w.position_code,w.position_placment,w.url,w.title,w.ad_text1,w.landing_page,fi.filename,fi.path,dv.start_date,dv.end_date
from wah_ad w
left join file_info fi on fi.some_id = w.wah_id
join deliverable dv on dv.obj_id = w.wah_id
where position_code = 'directory'
and getdate() > start_date
and getdate() < end_date
order by newid()