select JobAds.AdID, JobAds.Title, JobAds.Description, JobAds.Date, AdPhotos.PhotoName, State.StateName, City.CityName, SubCategory.Name, JobAds.Date from State,City,SellerDetails,JobAds, AdPhotos ,SubCategory where State.StateID = SellerDetails.StateID and City.CityID = SellerDetails.CityID and JobAds.SellerID = SellerDetails.SellerID and JobAds.AdID = AdPhotos.AdID and JobAds.SubCategoryID = SubCategory.SubCategoryID order by JobAds.Date desc
and AdPhotos.PhotoName in (select top 1 PhotoName from AdPhotos where AdID = JobAds.AdID)
(select top 1 PhotoName from AdPhoto Where AddId=JobAds.AdID) as PhotoName
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)