mysql sql CRUD

    删除别名问题

delete from aaa where id in (select id from bbb)   对

delete from aaa a where exist(select id from bbb where id=a.id)  错

delete a from aaa a where exist(select id from bbb where id=a.id)  对

    两表更新多个字段

update student a,student2 b
set a.class_name=b.class_name,
a.name=b.name,
a.age=b.age
where a.id=b.id

异或函数

select BIT_XOR(is_valid) from student
group by sname --is_valid两个相同为0,不同为1

猜你喜欢

转载自itace.iteye.com/blog/2367478