标签:
1.关联查询修改
UPDATE ex_question_questioncategory t5 INNER JOIN
(SELECT qc.QUESTION_ID,qc.QUESTION_CATEGORY_ID FROM ex_question_questioncategory qc RIGHT JOIN
(SELECT q.QUESTION_ID,q.CONTENT from ex_question q WHERE q.CONTENT LIKE ‘%关键字%‘) t1
ON qc.QUESTION_ID =t1.QUESTION_ID
) t2
ON t5.QUESTION_ID=t2.QUESTION_ID
SET t5.QUESTION_CATEGORY_ID=‘f39d2a3e49c0b98f0149c1f4cd9f0022‘
2.-- 查询A表中存在而B表中不存在的数据(A:domain,B:resource中有个外键)
select a.* from sys_domain a where not EXISTS (select b.DOMAIN_FK from sys_resource b where a.DOMAIN_ID=b.DOMAIN_FK)
mysql 常用数据查询
标签:
原文地址:http://www.cnblogs.com/nxblog/p/4200724.html