gpt4 book ai didi

php - 从表中选择值

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

我有包含以下条目的表格。现在我想选择具有 timeset_id=0timeset_id !=0 的值。

我想选择 did_id except did_id=219.Like fields only with timeset_id=0

SELECT * FROM routing_relation WHERE account_id = 36;
+-----+------------+--------+------------+----------+--------------+------------+-------------+
| id | account_id | did_id | timeset_id | route_id | routing_type | voice_file | voice_file2 |
+-----+------------+--------+------------+----------+--------------+------------+-------------+
| 302 | 36 | 183 | 0 | 8 | ER | | |
| 301 | 36 | 179 | 0 | 7 | ER | | |
| 305 | 36 | 185 | 0 | 11 | ER | | |
| 293 | 36 | 160 | 0 | 35 | ER | | |
| 295 | 36 | 162 | 0 | 1 | ER | | |
| 306 | 36 | 219 | 2 | 12 | ER | | |
| 297 | 36 | 165 | 0 | 3 | ER | | |
| 307 | 36 | 219 | 0 | 13 | ER | | |
| 303 | 36 | 184 | 0 | 9 | ER | | |
| 299 | 36 | 167 | 0 | 5 | ER | | |
+-----+------------+--------+------------+----------+--------------+------------+-------------+
10 rows in set (0.00 sec)

答案应该是这样的

| did_id | timeset_id |
| 183 | 0 |
| 179 | 0 |
| 185 | 0 |
| 160 | 0 |
| 162 | 0 |
| 165 | 0 |
| 184 | 0 |
| 167 | 0 |

最佳答案

如果我没理解错的话 - timeset_id=0 & timeset_id !=0 让你想全选。那么你想要 did_id=219,但前提是 timeset_id=0。

SELECT * FROM routing_relation WHERE account_id=36 AND NOT ( did_id=219 AND timeset_id<>0)

关于php - 从表中选择值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32561214/

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