select * from a where name='aa' and sex='man' and leaver=1......

解决方案 »

  1.   

    select 
        * 
    from 
         a 
    where
            a.name like 'D%'
        and a.sex='female'
        and a.leaver='本科'
    ...
    名字以D开头的,女的,本科学历.....
      

  2.   

    String subStr1="";
    String subStr2="";
    String subStr3="";
    String AllSQL="";if(!name.equals("")){
       subStr1="(name like '%"+name+"%') and ";
    }
    else if(!sex.equals("")){
       subStr2="(sex = '"+sex+"') and ";
    }
    ...AllSQL="select * from a where"+subStr1+subStr2...."某固定条件";