在一个查询中选择插入和更新MySql

时间:2015-12-23 14:12:55

标签: mysql sql select insert sql-update

我正在尝试从3个表中更新一个表工作正常,但我想在第4个表中插入数据之后从3更新表,这里我正在做什么

INSERT INTO relation_table(cid,pid,liid,lnid,lgid,l_key)
SELECT  a.cid,
        a.pid,
                b.liid,
                c.lnid,
                d.lgid,
                md5(CONCAT(a.cid, a.pid, a.lurl, c.lnid, d.lang))
FROM    links a
        INNER JOIN links_table b
            ON a.lurl = b.lurl
        INNER JOIN lname_table c
            ON a.lname = c.lname
                INNER JOIN lang_table d
            ON a.lang = d.lang
where a.checked != "3" limit 2;

update links SET checked='3'
WHERE lid=a.lid

最后声明不适用于更新

请帮助;)

1 个答案:

答案 0 :(得分:0)

试试这个:

<?xml version="1.0"?>
<ds:Signature Id="SignatureID" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
  <ds:SignedInfo>
    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
    <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
    <ds:Reference URI="http://localhost/simondocs/images/succes.png">
      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      <ds:DigestValue>Dv7mVn07JAKmm77J0PzqJ1N00SI=</ds:DigestValue>
    </ds:Reference>
  </ds:SignedInfo>
  <ds:SignatureValue Id="SignatureID">FHQiNBNrNVm/0yCNrvlifVpw9I10fyEQkXrAGslIOzBRtnPRBUDS3tE9RtvWbVxObQLhkn4Im5wcZoOtvl/K8fiAe45Pwvj3Q7trql+BCq3jDogYi83mlSaoW1ScU5Vmdl/jv6qfros0R7jelEqNiEkIF1n8dCZJBdzY/pY2vhkzM2MeiPxfHRYgMT3tgMUkhBGiU6EjGtitSWT840L/dz3HIRSXr4PCx7qAV108S8ICkXJPTp4Qs+32Tk1T7ha45BN7A+rHtyupd2xrCu7JCEHDn3k0XJL0/ARprqvZVpzqt2c/GLCjrX3fAJy7Yxs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GLVhwbg0IkUBtadB1QAxzghsR6OPuoGAk2ZD/rdKxtkmXiN5tRqHpRKfCh3cBhhhaiDW7/i+Hq+magS5qDGh8hUUJReQ+7ei5a7SZeew/gvgW47yXc/RLNYqNNbfIw==</ds:Modulus>
        <ds:Exponent>AQAB</ds:Exponent>
      </ds:RSAKeyValue>
    </ds:KeyValue>
  </ds:KeyInfo>
</ds:Signature>