select Towns.State, Towns.CCODE, Towns.RCode, ; iif(m.lcState="MA",space(4),Towns.TOWN) as TOWN, ; sum(iif(!empty(Seller),1,0)) as LogNumSal, ; sum(iif(empty(Seller),1,0)) as LogNumMtg, ; sum(iif(PRICE>=1000000 or MORTGAGE>=1000000,1,0)) as LogNumMM, ; min(date) as MinActDate, max(date) as MaxActDate, ; M.lcJustName as FileName, ; iif(EXTRYEAR<"10","20"+EXTRYEAR,"19"+EXTRYEAR) as EXTRYEAR, EXTRWEEK ; from (m.lcFileName) tbl ; INNER join Towns on tbl.CCODE + tbl.TOWN = Towns.CCODE + Towns.townold ; group by 1, 2, 3, 4 ; && Group by registry for MA into cursor curTempWe just changed our mind and decide, that we would like to calculate separately MinActDate and MinLCActDate, where first is when DeedType<>"LC" and the second is when DeedType = "LC". I'm thinking, how can I modify this select, to produce both fields correctly?