$house_sql='SELECT v.id, h.name, u.user_login as phone, v.date, v.time, v.consultant_id as consultant_id, v.handle, v.handle_date FROM tospur_view_house v '
$house_sql='SELECT v.id,h.name,h.city_id as cityId,u.user_login as phone,v.date,v.time,v.consultant_id as consultant_id,v.handle,v.handle_date,c.imageUrl,c.name as consultant_name FROM tospur_view_house v '
.'left join tospur_house h on v.house_id = h.id '
.'left join wp_users u on v.user_id = u.id '
.'where v.id = '.$house_id;
$consultant_sql='SELECT u.id,u.display_name FROM wp_users u '
.'left join wp_usermeta m on u.id=m.user_id where meta_key="wp_user_level" and meta_value=7;';
global$wpdb;
.'left join tospur_consultant c on v.consultant_id = c.id '
$sql='select c.id, c.cityId, c.mobile, c.imageUrl, c.name as display_name, c.introduction, s.average_score from '.Config::TOSPUR_CONSULTANT.' c '.
'left join (select consultant_id,sum(score)/count(score) as average_score from '.Config::TOSPUR_CONSULTANT_SCORE_TABLE.' group by consultant_id) s '.
'left join (select consultant_id,sum(score)/count(score) as average_score from '.Config::TOSPUR_CONSULTANT_SCORE_TABLE.' where valid = 1 group by consultant_id) s '.
'on c.id = s.consultant_id where c.id = '.$consultant_id;