nimonew
V2EX  ›  数据库

mysql 触发器能设置动态表名吗?

  •  
  •   nimonew · Nov 14, 2016 · 1192 views
    This topic created in 3486 days ago, the information mentioned may be changed or developed.

    需要在一个表插入数据时,在另一个表也插入数据,另一个表的表名是根据前一个表的一个字段计算出来的,这个有办法实现吗?

    3 replies    2016-11-14 18:12:09 +08:00
    laoyur
        1
    laoyur  
       Nov 14, 2016   ❤️ 1
    可以的,参考这个项目: https://github.com/ptorba/mysql-history
    nimonew
        2
    nimonew  
    OP
       Nov 14, 2016
    @laoyur 好的,我看看,谢谢
    laoyur
        3
    laoyur  
       Nov 14, 2016
    @x537196 可以看一下我以前的一篇文章,可能对你写触发器方面有点帮助 https://laoyur.com/archives/171
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5976 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 02:10 · PVG 10:10 · LAX 19:10 · JFK 22:10
    ♥ Do have faith in what you're doing.