搞不懂到底要找什么样的东西啊?
如果单从字面上看下面的语句就可以搞定
SELECT *
FROM tablename
WHERE field3 = 'cc' or (field1 = 4 and field2 = 'j');

解决方案 »

  1.   

    选择出来的记录应该是
    1,w,aa
    2,w,aa
    3,w,aa
    4,d,bb
    吗?
      

  2.   

    规则是这样的
    第二字段的优先(w〉j〉d)
      

  3.   

    select rownum,第二字段,第三字段
    from table
    where 第二字段='w' or 第二字段='j'
    order by 第二字段,第三字段--------->不是这样吧,也太那个了!
      

  4.   

    select * from (
    select col1,col2,col3,row_number() over(partition by col1 order by col2 desc) rnum
    from tbname 
    ) t
    where rnum=1;
      

  5.   

    select * from tbname a where a.col2=(select max(b.col2) where b.col1=a.col1)
      

  6.   

    select * from (
    select col1,col2,col3,row_number() over(partition by col1 order by col2 desc) rnum
    from tbname 
    ) t
    where rnum=1;