if you're sure that table producthistory will have a record for beginning date of every month you can do thisSELECT base_rate, doc_pt, chgdate FROM producthistoryWHERE chgdate = DATEADD(mm,DATEDIFF(mm,0,chgdate),0)AND prod_id = 1199812ORDER BY chgdate DESC
If your attempt is get data for product at the earliest available date in month then use likeSELECT base_rate, doc_pt, chgdateFROM(SELECT base_rate, doc_pt, chgdate ,MIN(chgdate) OVER (PARTITION BY DATEADD(mm,DATEDIFF(mm,0,chgdate),0)) AS MinMonthDateFROM producthistoryWHERE prod_id = 1199812)tWHERE chgdate = MinMonthDateORDER BY chgdate DESC
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs