BEGIN
set @uid=uid;
set @sg1=sg1;
set @sg2=sg2;
set @sex=sex;
set @wm=wm;
set @school=school;
set @zhiye=zhiye;
set @tixing=tixing;
set @aiqing=aiqing;
set @photo=photo;
set @gouwu=gouwu;
set @yule=yule;
set @chongwu=chongwu;
set @canyin=canyin;IF(@sex!=1) then
  set @sex1=and `user_inf`.`user_sex`= @sex;
  end IF;
  
IF(@wm!=1) then
  set @wm1=and `user_inf`.`stly`= @wm;
  end IF;
  IF(@zhiye is NOT null) then
  set @zhiye1=and `user_inf`.`zhiye` like % @zhiye %;
  end IF;IF(@tixing!=1) then
  set @tixing1=AND `user_inf`.`bodily`=@tixing;
  end IF;
  
  
IF(@school!=1)THEN
  if(@yisahng=1)THEN
    set @school1=AND `user_inf`.`school`>@school;
   END IF;
   ELSE (@yishang!=1)then
   set @school1=AND  `user_inf`.`school`=@school;
   END IF;
 END IF;
 
IF(@aiqing!=1) THENset @aiqing1=and `user_inf`.`love_state`=@aiqing;end IF;IF(@photo==1)THENset @photo1=AND `user_inf`.`user_image` IS NOT NULL;END IF;IF(@gouwu==1) thenSET @gouwu1=AND `user_inf`.`gouwu`=@gouwu;end IF;IF(@yule==1)THEN
SET @yule1=AND `user_inf`.`yule`=@yule;
end if;IF(@chongwu==1)then
SET @chongwu1=AND `user_inf`.`chongwu`=@chongwu;
END if;if(@canyin==1)then
SET @canyin1=and `user_inf`.`canyin`=@canyin;
END IF;set @c=CONCAT('select * from `user_inf` LEFT JOIN user_friends_info ON `user_inf`.`user_id`=`user_friends_info`.`Goodfriends`where `user_friends_info`.`Uid`=? and `user_inf`.`hight` BETWEEN ? and ? ',@sex1,'',@zhiye1,''
,@zhiye1,'',@tixing1,'',@school1,'',@aiqing1,'',@photo1,'',@gouwu1,'',@yule1,'',@chongwu1,'',@canyin1,';');prepare st from @c;EXECUTE st using @uid,@sg1,@sg2;DEALLOCATE prepare st;
END
这是我写多条件查询,报错,谁能给我看看这个,应该怎么写