can can - 5 months ago 20
SQL Question

Sql query to select different row with same ID

I have a simple table and I wanted to get a row with same ID but different values.

lets assume I don't know the IDs;

lets say I have;

I have feature "one" and I want to find the feature that has same ID with feature "one".


One way to do this is with the exists operator:

FROM   features f_outer
               FROM   features f_inner
               WHERE = AND
                      f_outer.feature != f_inner.feature AND
                      f_inner.feature = 'one')