$sql="select v.id,v.house_id,v.user_id,v.date,v.time,v.handle from view_house v where consultant_id = ".$consultant_id." order by v.date desc";
$sql="select v.id,v.house_id,v.user_id,v.date,v.time,v.handle from ".tospur_view_house_table." v where consultant_id = ".$consultant_id." order by v.date desc";
$consultant_sql='select c.*,u.display_name,s.average_score from tospur_consultant c '.
'left join wp_users u on c.id = u.ID '.
'left join (select consultant_id,sum(score)/count(score) as average_score from tospur_consultant_score where valid=1 group by consultant_id) s on c.id = s.consultant_id '.