表A
id name
1 4567
2 6548
3 8524
表B
id name
1 4567
如上表.我想在表A中取出不包含表B'name'的数据 且 排除表A'6548'的数据,取出8524
select * from A,B where instr(A.name,B.name) = 0; 该语句只能联合排除表B的4567 但是无法排除指定数据6548(该数据在变量.不在表B)
select * from A,B where not regexp '^6548$'; 该语句只能排除指定数据6548 但和上个语句结合 就不能使用,.我想一个语句 联合查询出来.
感激不尽
select name from A where name !='6548' and name not in (select name from B where id ='1');
或者:
select name from A where name not in ('6548',(select name from B where id='1'));
大恩不言谢