用case when ...then... 
      when...then... 
      ...
        ...
      ...
      else ....
  end
应该可以实现你的要求

解决方案 »

  1.   

    有表ecc_individual里有customer_id,name,id_num,home_phone,phone,email想取有相同
    1) first, the customer has identical ID #;
    2) then, the customer unqualified for 1), but has identical 姓名和地址;
    3) then, the customer unqualified for 1)+2), but has identical 姓名和座机
    4) then, the customer unqualified for 1)+2)+3), but has identical姓名和手机号码
    5) then, the customer unqualified for 1)+2)+3)+4) but has identical姓名和email
     
    在一个表里取相同的一个或俩个字段该怎么做呢
      

  2.   

    select distinct a.*
    from ecc_individual a,ecc_individual b
    where a.name = b.name and
          a.id_num = b.id_num and
          a.rowid <> b.rowid
      

  3.   

    a.rowid是指什么呢,
    有表ecc_individual里有customer_id,name,id_num,home_phone,phone,email想取有相同
    1) first, the customer has identical ID #;
    2) then, the customer unqualified for 1), but has identical 姓名和地址;
    3) then, the customer unqualified for 1)+2), but has identical 姓名和座机
    4) then, the customer unqualified for 1)+2)+3), but has identical姓名和手机号码
    5) then, the customer unqualified for 1)+2)+3)+4) but has identical姓名和email
    我主要想在一个表里实现这样的条件
      

  4.   

    按照我的理解
    1)select distinct a.*
      from ecc_individual a,ecc_individual b
      where a.customer_id = b.customer_id and
            a.rowid = b.rowid
    2)select distinct a.*
      from ecc_individual a,ecc_individual b
      where a.customer_id <> b.customer_id and
            a.name = b.name and
            a.id_num = b.id_num
    ...
    不晓得对不对~
      

  5.   

    不是这样的,是想求这个表的客户数量,
    1) first, the customer has identical ID #;
    2) then, the customer unqualified for 1), but has identical 姓名和地址;
    3) then, the customer unqualified for 1)+2), but has identical 姓名和座机
    4) then, the customer unqualified for 1)+2)+3), but has identical姓名和手机号码
    5) then, the customer unqualified for 1)+2)+3)+4) but has identical姓名和email
    按这样的如果id_num一样的话,剩下的按name和address,.....
    求客户量
      

  6.   

    sxykje(我爱老婆) 说的没错。。顶。我也爱老婆