› MySQL 5.5 Community Server
› MySQL 5.6 Community Server
› Percona Configuration Wizard
› XtraBackup 搭建主从复制
Great Sites on MySQL
› Percona
› MySQL Performance Blog
› Severalnines
推荐管理工具
› Sequel Pro
› phpMyAdmin
推荐书目
› MySQL Cookbook
MySQL 相关项目
› MariaDB
› Drizzle
参考文档
› http://mysql-python.sourceforge.net/MySQLdb.html
ohmyzsh
V2EX  ›  MySQL

MySQL 用户变量定义困惑。。。

  •  
  •   ohmyzsh · Nov 21, 2019 · 3880 views
    This topic created in 2513 days ago, the information mentioned may be changed or developed.

    mytable 表如下

    https://i.loli.net/2019/11/21/YwCVDFAJQXe4HOs.png

    select t.*,
        if(@s <> (@s := t.period_state), @d := t.date, @d) as start
        from mytable
        ) as t, (select @s:='', @d) init
    

    输出

    https://i.loli.net/2019/11/21/TuxyoAaPYUjRcQJ.png

    但我把 IF 语句改成 if(@s = (@s := t.period_state), @d, @d := t.date) 输出结果怎么不一样了呢?下面这个 BLOB 是什么东西,日期怎么不能显示出来呢?

    https://i.loli.net/2019/11/21/fPyYCAo295rNXQb.png

    ohmyzsh
        1
    ohmyzsh  
    OP
       Nov 21, 2019
    @Livid 无人回复,请删除,谢谢~
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3574 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:44 · PVG 12:44 · LAX 21:44 · JFK 00:44
    ♥ Do have faith in what you're doing.