码迷,mamicode.com
首页 > 数据库 > 详细

mysql 常用数据查询

时间:2015-01-04 13:18:09      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!