sql - Finding Rows based on a set of same columns in ORACLE -


consider following table:-

-----------------------------------------   id      teacher    subject     grade -----------------------------------------   1        jack       physics      8   2        paul       chemistry    10   3        susan      english      6   4        jack       maths        8   5        jack       physics     10   6        paul       chemistry   10 

i want identify rows same values teacher , subject columns. irrespective of values in id , grade columns. following rows identified:-

 -------------------------------------   id      teacher     subject   grade  -------------------------------------   1        jack       physics      8   2        paul       chemistry    10   5        jack       physics     10   6        paul       chemistry   10  ------------------------------------- 

how achieve such result in oracle sql.

select * table1 t1 exists (   select null table1 t2   t1."teacher" = t2."teacher"     , t1."subject" = t2."subject"     , t1."id" <> t2."id" ) order "id" 

demo: http://sqlfiddle.com/#!4/3d2bd4/3


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -