gpt4 book ai didi

MySQL 查询使用 Between 获取两个值

转载 作者:行者123 更新时间:2023-11-29 11:46:24 26 4
gpt4 key购买 nike

我需要从 mysql 数据库中选择数据。我从“FORM”VENUE=10000003START_DATE=1452673900END_DATE=1452663000 提交值。

数据库中存在startDate=1452673800endDate=1452663000venue=10000003

但我无法通过此查询得到结果

SELECT * FROM `training_calendar` WHERE `venue`='10000003' AND `startDate` BETWEEN (1452673800 AND 1452663000)
AND `endDate` BETWEEN (1452673800 AND 1452663000)

请帮忙

最佳答案

更改值的位置,最低日期必须位于 BETWEEN 运算符中的第一个:

SELECT * FROM `training_calendar` 
WHERE `venue`='10000003' AND `startDate` BETWEEN 1452663000 AND 1452673800
AND `endDate` BETWEEN 1452663000 AND 1452673800

关于MySQL 查询使用 Between 获取两个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34862161/

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