2020年12月24日星期四

Listing Keys which have same values in SQL

Here is the table:

CREATE TABLE ABC(   key NUMBER(5),    val NUMBER(5)   );    insert into ABC (key, val) values (1,1);  insert into ABC (key, val) values (1,2);  insert into ABC (key, val) values (1,3);  insert into ABC (key, val) values (2,3);  insert into ABC (key, val) values (1,4);  insert into ABC (key, val) values (2,4);  insert into ABC (key, val) values (2,5);  insert into ABC (key, val) values (3,5);  insert into ABC (key, val) values (1,6);  insert into ABC (key, val) values (2,6);  

Desired Output: enter image description here

I want to find all maximum combination pair of keys that have the same value 'val' and list them.

https://stackoverflow.com/questions/65444592/listing-keys-which-have-same-values-in-sql December 25, 2020 at 09:49AM

没有评论:

发表评论