SELECT COALESCE (b.customwpurl, '') AS customwpurl, COALESCE (b.Name, '') AS GalleryName, a.ID, a.GalleryID, a.Source, Coalesce(a.ExhibitionDescription,'') as ExhibitionDescription, Coalesce(a.NameDescription,'') as NameDescription, Coalesce(a.ArtistName,'') as ArtistName, Coalesce(a.PhotoAlbumUrl,'') as PhotoAlbumUrl, Coalesce(a.PhotoCover,'') as PhotoCover, COALESCE (a.FromDate,'') as FromDate, COALESCE (a.ToDate,'') as ToDate, CASE WHEN (GETDATE() between a.FromDate and a.ToDate) THEN 1 WHEN (COALESCE (a.FromDate,'') > GETDATE()) THEN 2 WHEN (COALESCE (a.FromDate,'') < GETDATE()) THEN 3 END AS ExhibitionDates , 'http://opportunities.com.lb/GalleryMagazine2018/upload/' + CONVERT(varchar(100), GalleryID) + '/' + a.PhotoCover AS DisplayExibitionPhotoCover from Galleries_Listing_Exhibitions as a, dbo.Galleries_Listing as b where b.ID = a.GalleryID and Coalesce(a.ListInVirtualGallery,0) =1 and Coalesce(a.PhotoAlbumUrl,'') <> '' and Coalesce(a.PhotoCover,'')<>'' and (GETDATE() between a.FromDate and a.ToDate) order by a.FromDate desc