database - SQL - How to list all tuples in a relation such that tuple 1 is greater than tuple 2 -
database - SQL - How to list all tuples in a relation such that tuple 1 is greater than tuple 2 -
suppose have relation 1 column "value (int)" , values in descending order.
+----------+ + value + +----------+ + 10 + + 9 + + 8 + + 7 + ....
how can list combinations contains 2 tuples such first tuple greater sec tuple
note: may exist 2 tuples same value
the desired outputs should like: (10,9) (10, 8) (9,8), (9,7) (8,7)
you can cross bring together on same table.
select t1.value value1, t2.value value2 thing t1 bring together thing t2 on (t1.value != t2.value , t1.value > t2.value)
sql database
Comments
Post a Comment