|
@@ -621,12 +621,18 @@ FROM
|
621
|
621
|
a.name AS name,
|
622
|
622
|
a.phone as phone,
|
623
|
623
|
if(a.sex = 1, '男', if(a.sex = 2, '女', '未知')) as sex,
|
624
|
|
- b.name as consultantName,
|
625
|
|
- b.tel as consultTel
|
|
624
|
+ CASE
|
|
625
|
+ WHEN b.NAME IS NULL THEN
|
|
626
|
+ c.NAME ELSE b.NAME
|
|
627
|
+ END AS consultantName,
|
|
628
|
+ CASE
|
|
629
|
+ WHEN b.tel IS NULL THEN
|
|
630
|
+ c.tel ELSE b.tel
|
|
631
|
+ END AS consultTel
|
626
|
632
|
FROM
|
627
|
633
|
ta_recommend_customer a
|
628
|
|
- LEFT JOIN ta_person b ON (a.realty_consultant = b.person_id or a.realty_consultant = b.user_id)
|
629
|
|
- LEFT JOIN ta_person c on a.recommend_person = c.person_id
|
|
634
|
+ LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
|
|
635
|
+ left join ta_person c on a.realty_consultant = c.user_id
|
630
|
636
|
<where>
|
631
|
637
|
a.status > 0
|
632
|
638
|
and a.verify_status = 1
|