在TABLE A中 找出所有X列和Y列两个都相等的数据怎么写呢??最好用COUNT =1的那种写法的

解决方案 »

  1.   

    cout=1什么意思
    select * from a where x=y
      

  2.   

    不是X=Y。。比如有两行,他们的X相等,Y相等
      

  3.   

    可以用group by
    也可以用分析函数的partition by
    不知你要什么样的查询结果
    只显示X,Y重复的记录?
      

  4.   

    select * from t group by x,y having count(1) > 1;这样?
      

  5.   


    select x, y 
    from A
    group by x,y
    having count(1)>1
      

  6.   

    select x, y ,count(1) nm
    from A 
    group by x,y 
    having count(1)>1 
      

  7.   


    有误,group by 的时候,不可能select * 的啊,只能select group by的列啊
      

  8.   


    是count=1啊。那我上面的是错的,更正如下:select x, y ,count(1) nm
    from A 
    group by x,y 
    having count(x)=1 
      

  9.   

    select x, y ,count(1) nm
    from A 
    group by x,y 
    having count(x)=1 
      

  10.   

    select x, y ,count(1) nm 
    from A 
    group by x,y 
    having count(x)=2