mysql 常用数据查询

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)

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。