只要name(姓名)+任意一个电话相同的情况下,就提示该学员已存在
xy表:
id name(姓名) mother_mobile(妈妈电话) father_mobile(爸爸电话) home_tel(家庭电话)
我现在是想做个判断,只要name(姓名)+任意一个电话相同的情况下,就提示该学员已存在
下面是我写的SQL语句,好复杂,而且我不知道对不对,有没有更简单的?
xy.name='".$arr_xy_info['name']."'
and (
((xy.mother_mobile='".$arr_xy_info['mother_mobile']."' or xy.father_mobile='".$arr_xy_info['mother_mobile']."' or xy.home_tel='".$arr_xy_info['mother_mobile']."') and xy.father_mobile<>'' and xy.home_tel<>'' and xy.mother_mobile<>0)
or ((xy.mother_mobile='".$arr_xy_info['father_mobile']."' or xy.father_mobile='".$arr_xy_info['father_mobile']."' or xy.home_tel='".$arr_xy_info['father_mobile']."') and xy.father_mobile<>'' and xy.home_tel<>'' and xy.mother_mobile<>0)
or ((xy.mother_mobile='".$arr_xy_info['home_tel']."' or xy.father_mobile='".$arr_xy_info['home_tel']."' or xy.home_tel='".$arr_xy_info['home_tel']."') and xy.father_mobile<>'' and xy.home_tel<>'' and xy.mother_mobile<>0)
)