gpt4 book ai didi

mysql - 我可以查询 Enum + 1 吗?

转载 作者:行者123 更新时间:2023-11-30 00:52:16 27 4
gpt4 key购买 nike

如果我有一个 dayEnum 定义为'Sun','Mon','Tue','Wed','Thu','Fri','Sat'

有什么办法可以提到这个枚举的增量吗?像这样的WHERE dayEnum IN ('Sun', 'Sun'+1)

最佳答案

您可以使用枚举的内部编号;

WHERE dayEnum IN (1, 2)

For example, a column specified as ENUM('Mercury', 'Venus', 'Earth') can have any of the values shown here. The index of each value is also shown.

Value       Index
-----------------
NULL NULL
'' 0
'Sun' 1
'Mon' 2
'Tue' 3
....

Source

关于mysql - 我可以查询 Enum + 1 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20869939/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com