2014-04-08 2 views
0

sqlite의 다른 select에서 복합 select 문을 수행하는 방법? WHERE 절에 조건을 추가 할 수 있습니까?SqLite composite Select 문에서 선택

나는

 
SELECT detection_id, 
     evalround_id, 
     min(detection.posright, labelgt.posright) - max(detection.posleft, labelgt.posleft) + 1 
     AS overlap_width 
FROM detection, labelgt 
WHERE 
     labelgt.timestamp = detection.timestamp 

내가 불행하게도 쿼리를 실행하는 동안 오류 '오류로 종료

 AND overlap_width > 0

'overlap_width '계산에 조건을 추가 할 작업 문 다음되지 않은 : 그런 열을 : overlap_width '.

나는, '그런 칼럼 : detection.posleft를 쿼리를 실행하는 동안 오류'는 함께 ENS하지

 
SELECT 
    * 
    FROM 
     (
     SELECT detection_id, 
       evalround_id, 
       min(detection.posright, labelgt.posright) - max(detection.posleft, labelgt.posleft) + 1 
       AS overlap_width 
      -- overlap_width * overlap_height AS overlap_area 
     FROM detection, labelgt 
     WHERE 
       labelgt.timestamp = detection.timestamp 
     ) AS IT 
    WHERE 
     IT.overlap_width > 0 

을 복합 문을 만들려고. 그러나 테이블에 유효한 열 감지. 위치 기록이 있습니다.

+0

[나를위한 작품] (http://sqlfiddle.com/#!5/af6c1/2); 당신의 예제는 당신이 실제로 시도한 것이 아닙니다. –

답변

0

SQLite SQLite를 사용하면 내부 열의 상태를 파악할 수 있습니다. 즉

SELECT * FROM (select min(b.cold1-c.col2) as tid, * from table1 b , table2 c) where tid = -538 
+0

SqliteStudio를 사용하여 'detect_id> 9000'이라는 구문에서 'select detection_id where where detect_id> 9000'을 성공적으로 실행했지만 'where 9000'이 실패한 검색에서 detect_id를 선택하십시오 (해당 열은 없습니다). – dousin

관련 문제