V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
bmcjxhgwy
V2EX  ›  Python

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

  •  
  •   bmcjxhgwy · Nov 11, 2019 · 4342 views
    This topic created in 2359 days ago, the information mentioned may be changed or developed.
    例子:SET @a= ('vehicle','traffic');
    select count(*) from 表 WHERE 字段 in @a

    这样子写报错了,如何定义一个列表结构的常量呢?
    3 replies    2019-11-11 16:36:14 +08:00
    kiracyan
        1
    kiracyan  
       Nov 11, 2019
    select 1
    union
    select 2
    binjjam
        2
    binjjam  
       Nov 11, 2019   ❤️ 1
    set @a='vehicle,traffic';
    select count(*) from 表 WHERE FIND_IN_SET(字段,@a);
    bmcjxhgwy
        3
    bmcjxhgwy  
    OP
       Nov 11, 2019
    非常感谢,已解决
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3197 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 14:14 · PVG 22:14 · LAX 07:14 · JFK 10:14
    ♥ Do have faith in what you're doing.