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

MySql Update Select 嵌套

时间:2014-12-25 13:00:40      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:

UPDATE `TB_CM_Dic` SET `ParentID` = (SELECT `ID` FROM (SELECT * FROM `TB_CM_Dic`) AS B WHERE `DicName` = 药品类别)
WHERE `ID` = 
(
    SELECT `ID`
    FROM(
        SELECT *
        FROM `TB_CM_Dic`
        WHERE `DicName` = 日常用品 AND `ParentID` = 
        (
            SELECT `ID` D
            FROM `TB_CM_Dic` D
            WHERE D.`DicName` = 药品
        )
    ) AS C
)

 

MySql Update Select 嵌套

标签:

原文地址:http://www.cnblogs.com/xachary/p/4184300.html

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