php - comparing different columns and rows on the same table -
we making simple database our school programme. have table this:
id b 1 john stacey 2 stacey mark 3 candice rick 4 stacey rick 5 rick stacey
if input stacey's name, display number of rows where:
for every row (say, x , y)
rowx-columna = rowy-columnb , rowy-columna = rowx-columnb
in case, should output:
2 rows:
4 stacey rick 5 rick stacey
thanks! have more 100 students won't able manually. again, appreciate hint.
try query friend:
select t1.* table1 t1 inner join table1 t2 on t1.a = t2.b , t1.b = t2.a;
Comments
Post a Comment