Hi all,I'm looking for a little support in calculating percentages in SQL Server.I am trying to display a property list of Average Days on Market per branch. I currently have code that displays all sold properties for a given month, and shows each properties 'Date on Market' and 'Date Sold'I need to group this information by branch, with a further column showing the 'Average Days on Market' for each branch respectivelyI'm assuming this will include doing a subtraction of 'date on market' from 'date sold', and then producing an average of this result and grouping per branch.Here Is my current code: select pcode as PropertyCode, phsename as HouseName, phseno as HouseNumber, paddress1 as Address1, paddress2 as Address2, paddress3 as Address3, ppostcode as PostCode, pforsdate as DateOnMarket, pexchdate as DateSold, as DaysOnMarket from property where ptype='S' and synchDel='0' and pexchdate between '2010-11-01' and '2010-11-30'UNION ALL (Select pcode as PropertyCode, phsename as HouseName, phseno as HouseNumber, paddress1 as Address1, paddress2 as Address2, paddress3 as Address3, ppostcode as PostCode, pforsdate as DateOnMarket, pexchdate as DateSold, as DaysOnMarketfrom proparchwhere ptype='S' and synchDel='0' and pexchdate between '2010-11-01' and '2010-11-30')order by DateSold
Any help with this at all would be greatly appreciated. Thanks so much.