V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
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
bmcjxhgwy
V2EX  ›  MySQL

请教一下 mysql 中能否定义一个为列表的常量啊?

  •  
  •   bmcjxhgwy · 2019-11-11 13:24:16 +08:00 · 4085 次点击
    这是一个创建于 1599 天前的主题,其中的信息可能已经有所发展或是发生改变。
    SET @motor_vehicle = ('vehicle','traffic');
    select count(*) from '表' WHERE ‘字段’ in @motor_vehicle 
    

    这样子写报错了,如何定义一个列表结构的常量呢?

    2 条回复    2019-11-13 09:40:17 +08:00
    fuxkcsdn
        1
    fuxkcsdn  
       2019-11-13 09:32:14 +08:00 via iPhone
    用字符串拼接( concat )
    gigantic222
        2
    gigantic222  
       2019-11-13 09:40:17 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1185 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:08 · PVG 07:08 · LAX 16:08 · JFK 19:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.