x******m 发帖数: 736 | 1 table2用来表明table1中每个col的category,比如你的table
id col value col_id category
1 身高,1米八 3 body_index
1 体重,300斤 4 body_index
1 职业,学生 1 other_index
2 身高,1米七 3 body_index |
|
m*********a 发帖数: 3299 | 2 select t1.id, t1.value
from table1 t1
where To_char(t1.id)||'_'||t1.value
not in
(
select To_char(t2.id)||'_'||t2.value
from table2 t2
) |
|
m*****y 发帖数: 229 | 3 sql server 的话,这个应该work。
select t2.*
from table2 t2
where not exists (select 1 from table1 t1 where t1.id=t2.id and t1.value=t2.
value) |
|
|
|