sql compare two unique rows from the same table -


im hoping straight forward question cannot work out syntax it.

i need find if value within "id" exists in "id2", lets tables called "teacher"

id-id2 10-1 11-2 12-13 13-4 

the match there row 4 13 exists in id2, need pull out select query, can advise? thanks.

hi on top of have second table called staff following setup

id-name 1-smith 2-jones 3-bruce 

whereby id same id in teacher table, think need join them here im not sure id in second table. information need second table name cartesian product should above processing done table 1. in advance

scrap that, solved it, thanks

is want?

select t.* teacher t exists (select 1 teacher t2 t2.id = t.id2); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -