V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
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 · 3595 views
    This topic created in 2349 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   ·   Solana   ·   1065 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 22:52 · PVG 06:52 · LAX 15:52 · JFK 18:52
    ♥ Do have faith in what you're doing.