gpt4 book ai didi

MySQl:比较值的位置

转载 作者:行者123 更新时间:2023-11-28 23:39:38 25 4
gpt4 key购买 nike

我有以下 MySQL 表 Test_Results

| ID | Test_ID | Device_OS| Status | Date     | Device_ID |
| 1 | 1 | Android | passed | 2015/10 | 1 |
| 2 | 1 | Android | failed | 2015/10 | 1 |
| 3 | 15 | iOS | failed | 2015/11 | 2 |
| 4 | 20 | Android | passed | 2015/11 | 1 |
| 5 | 27 | Android | failed | 2015/11 | 1 |
| 6 | 10 | iOS | failed | 2015/12 | 2 |
| 7 | 5 | Android | passed | 2015/12 | 1 |

我需要选择在 ID = 1 的设备上失败但在 ID =2 的设备上通过的测试。

所以我需要根据Device_ID比较值,你能指导我在互联网上搜索什么吗?

最佳答案

如果你想同时满足这两个条件,那么试试这个:

SELECT Test_ID
FROM Test_Results
WHERE Test_ID IN (SELECT Test_ID FROM Test_Results WHERE Device_ID = 1 AND Status LIKE 'failed')
AND Device_ID = 2 AND Status LIKE 'passed'

关于MySQl:比较值的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34745468/

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