can can - 2 years ago 131
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".

Answer Source

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')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download