怎么查找数据库某几个字段值相同的数据啊?? sql怎么写啊

解决方案 »

  1.   

    查找字段1=字段2=字段3的数据
    select * from tb where 字段1=字段2 and 字段2=字段3
      

  2.   

    select * from tb
    where col1=col2 or col1=col3  ?
      

  3.   


    select a.col1,b,col2 from a,b
    where a.col3=b.col3 and a.col4=b.col4
      

  4.   

    我举个例子吧T1  DB     DA 
    1       3
    1       4
    2       1
    3       6
    2       H
    1       54找出T1表中 DB字段中值相同的数据大于1的
    结果DB     DA 
    1       3
    1       4
    2       12       H
    1       54
      

  5.   

    select a.1,b.2 from a,b
    where a.3=b.3and a.4=b.4
      

  6.   

    这难道是对CSDN不满!
    哈哈just a joke
      

  7.   

    select * from T1 group by db HAVING count(*)>=2
      

  8.   


    SELECT * FROM TB WHERE DB IN (SELECT DB FROM TB GROUP BY DB HAVING COUNT(DB)>1)??
      

  9.   

    select case when count(db)>1 then db
                else 
                end ,da
    from t1