Select tblsections.sectionid, tblsections.banner, tblsections.Sub_banner, tblLayouts.layoutfilename from tblsections, tbllayouts where (tblsections.type = #url.type# and tblsections.sectionid = #url.sectionid#) and tbllayouts.layoutid=tblsections.sectionlayoutid Select '' as surveyid, '' as surveyimage, '' as surveytext, '' as title, '' as brief_Desc, 0 as Article_ID, trelsectionart.articleid, trelsectionart.FS_TEXTONLY, trelsectionart.FS_ORDER, trelsectionart.FS_EXP_DATE, trelsectionart.FS_STATUS From TrelSectionArt, Tblsections Where tblsections.sectionid = #url.sectionid# and trelsectionart.SECTIONID = tblsections.SECTIONID and tblsections.type = #url.type# and Tblsections.STATUS = #url.status# and trelsectionart.articleid is null and trelsectionart.FS_TEXTONLY is not null and trelSectionArt.FS_Status = 1 and (trelsectionart.FS_EXP_DATE >= #CreateODBCDate(Now())# or trelsectionart.FS_EXP_DATE is null) union all Select '' as surveyid, '' as surveyimage, '' as surveytext, tblArticles.title as title, tblArticles.brief_Desc as brief_Desc, tblArticles.ArticleID as Article_ID, trelsectionart.articleid, trelsectionart.FS_TEXTONLY, trelsectionart.FS_ORDER, trelsectionart.FS_EXP_DATE, trelsectionart.FS_STATUS From TrelSectionArt, Tblsections, tblArticles Where tblsections.sectionid = #url.sectionid# and trelsectionart.SECTIONID = tblsections.SECTIONID and tblsections.type = #url.type# and Tblsections.STATUS = #url.status# and trelSectionArt.FS_Status = 1 and tblArticles.articleid = trelsectionart.articleid and (trelsectionart.FS_EXP_DATE >= #CreateODBCDate(Now())# or trelsectionart.FS_EXP_DATE is null) union all Select distinct TrelSectionSurvey.surveyid as surveyid, TrelSectionSurvey.surveyimage as surveyimage, TrelSectionSurvey.surveytext as surveytext, '' as title, '' as brief_Desc, 0 as Article_ID, trelsectionart.articleid, trelsectionart.FS_TEXTONLY, trelsectionart.FS_ORDER, trelsectionart.FS_EXP_DATE, trelsectionart.FS_STATUS From TrelSectionArt, Tblsections, tblArticles, TrelSectionSurvey Where tblsections.sectionid = #url.sectionid# and trelsectionart.SECTIONID = tblsections.SECTIONID and tblsections.type = #url.type# and tblsections.STATUS = #url.status# and trelSectionArt.FS_Status = 1 and trelsectionart.articleid is null and trelsectionart.FS_TEXTONLY is null and TrelSectionSurvey.sectionid = tblsections.sectionid and (trelsectionart.FS_EXP_DATE >= #CreateODBCDate(Now())# or trelsectionart.FS_EXP_DATE is null) order by trelsectionart.FS_ORDER Select tblmediafiles.MFName, trelsectionmedia.Med_Order, tblmediafiles.Image, tblmediafiles.Op_Image, tblmediafiles.Html, tblmediafiles.type, tblmediafiles.MFLink from tblmediaFiles, trelsectionmedia, tblsections where tblsections.sectionid = #url.sectionid# and trelsectionmedia.sectionid=tblsections.sectionid and tblmediafiles.mediaid = trelsectionmedia.mediaid and tblsections.type = #url.type# and (trelsectionmedia.EXP_DATE >= #CreateODBCDate(Now())# or trelsectionmedia.EXP_DATE is null) order by trelsectionmedia.med_order select distinct tblArticles.articleid, tblarticles.title, tlkpTopicGroup.TopicName, tlkpTopicGroup.TopicID from tblArticles, tlkpTopicGroup, TrelSectionArt where trelSectionArt.sectionid=#url.sectionid# and tblArticles.articleid = trelSectionArt.articleid and tblArticles.Status = #url.status# and ( (TblArticles.CAL_DATE_Start <= #CreateODBCDate(Now())# and TblArticles.CAL_DATE_END >= #CreateODBCDate(Now())# and TblArticles.CAL_DATE_END is not null and TblArticles.CAL_DATE_Start is not null) or (TblArticles.CAL_DATE_END is null and TblArticles.CAL_DATE_Start is not null and TblArticles.CAL_DATE_Start <= #CreateODBCDate(Now())#) or (TblArticles.CAL_DATE_Start is null and TblArticles.CAL_DATE_END is not null and TblArticles.CAL_DATE_END >= #CreateODBCDate(Now())#) or (TblArticles.CAL_DATE_Start is null and TblArticles.CAL_DATE_END is null) ) and tblArticles.Topicid = tlkpTopicGroup.Topicid order by tlkpTopicGroup.TopicName, tblarticles.title