oracle - How to count repeat values in multiples columns with a select -


i have position_table table:

     code_position   name      grade    validity    date elimination    level 1    aaaa01          manager   10       01/03/2016  31/12/2999          high 2    bbbb01          analyst   09       01/03/2016  31/12/2999          low 3    cccc01          staff     05       01/03/2016  31/12/2999          high 4    bbbb01          analyst   09       01/03/2016  31/12/2999          high 5    aaaa01          manager   10       01/03/2016  31/12/2999          low 6    dddd01          intern    01       01/03/2016  31/12/2999          high 7    dddd01          intern    01       01/07/2016  31/12/2999          low 

i use query find , count same code_position:

select code_position, count(code_position) position_table group code_position having count(code_position) > 1; 

and result:

    code_position   count(code_position) 1   aaaa01          2 2   bbbb01          2 3   dddd01          2 

note:

  1. the aaaa01 code repeated twice , has same date of validity , grade.
  2. the bbbb01 code repeated twice , has same date of validity , grade.
  3. the dddd01 code repeated twice , have different date of validity.

now need check code_position repeated , if have same validity date , grade to. like: aaaa01 , bbbb01.

you can use more 1 condition in group by. if use more conditions, compared , grouped if identically.

select     code_position,     count(code_position),     validity,     grade position_table group     code_position,     validity,     grade having count(code_position) > 1  

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -