sql - mysql - fastest way to find rows having common field -
consider table 2 colums, col1
, col2
.
i find fastest way compute rows having col2
equal col2
column of row having col1
equal given value.
for example, consider case want find names of people having same surname of person name 'john'
select t.* table t join table t2 on t2.col2 = t.col2 t2.col1 = 'some value'
you need indexes on both columns performance.
Comments
Post a Comment