SQLite Query using nested SELECT

前端 未结 1 634
清酒与你
清酒与你 2021-02-07 14:24

I\'m trying to select cpu_time from the db, but the time must correspond with a few other criteria - i.e. build_version, test_letter, design_index, multi_thread, and test_index<

相关标签:
1条回答
  • 2021-02-07 14:51

    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
    )
    
    0 讨论(0)
提交回复
热议问题