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

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -