gpt4 book ai didi

MySQL SELECT all 除了两列有特定数据的地方

转载 作者:行者123 更新时间:2023-12-01 00:23:51 25 4
gpt4 key购买 nike

抱歉,标题太困惑了,下面是我的表格(示例)和我想要实现的目标。

uid | title     | comment      | duration    | timestamp
---------------------------------------------------------
1 | test | test | d | 2013-09-15 12:00:00
2 | test | test | w | 2013-09-15 12:00:00
3 | test | test | m | 2013-09-30 12:00:00
4 | test | test | y | 2013-12-31 12:00:00
5 | test | test | d | 2013-09-16 12:00:00

基本上,我需要一个从该表中选择 * 的查询,除非 duration = d AND timestamp = 2013-09-15 12:00:00 在一起。因此,唯一应该从结果中排除的记录是第 1 行。

我需要的东西看起来很简单,我确信我错过了一些东西,但我真的很难接受它......

非常感谢所有帮助。

最佳答案

select * 
from table
where not (duration = 'd' AND timestamp = '2013-09-15 12:00:00');

关于MySQL SELECT all 除了两列有特定数据的地方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18828187/

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