select
COUNT(pd.property_id) AS `Beginning Total File Count`,
COUNT(pd.recv_dt) as `average days in inventory`,
AVG(pd.status = 'P') as `average days in pre-marketing`,
AVG(pd.status NOT IN('I','C')) as `average days onMarket`,
AVG(pd.status ='U') as `average days UnderContract`,
SUM(pd.status = 'O') as `Total FilesOccupied Status`,
SUM(pd.status = 'O') / COUNT(pd.property_id) as `percentage of Occupied /
total file count`
from resnet.property_Details pd
I'm trying to get
- Beginning total file count
- Average days in inventory
- Average days in Pre-Marketing
- Average days on market
- Average days under contract
- Total files in occupied status
- Percentage of Occupied / total file count
Not sure if my query is written properly, please help :)