且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用嵌套 SELECT 的 SQLite 查询

更新时间:2022-11-05 17:33:09

您应该始终使用 WHERE xxx IN (SELECT xxx FROM ...),而不是在内部选择中选择多个项目.您可以在外部选择中添加这些,例如:

You should always use WHERE xxx IN (SELECT xxx FROM ...), instead of selecting multiple items in the inner select. You can add those in the outer select though, for example:

SELECT DISTINCT 
    mgc_version, 
    test_type_letter, 
    design_index, 
    test_index, 
    cpu_time, 
    multi_thread 
FROM TestExecutions
WHERE cpu_time IN 
(
    SELECT DISTINCT cpu_time 
    FROM TestExecutions 
    WHERE test_type_letter BETWEEN $testletter AND $testletter
)