외래 키로 공통 열 comm_name을 갖는 3 개의 테이블 table_1, table_2 및 table_3이 있습니다. 이러한 3 개의 테이블을 조인하여 최대 열 수 data_id를 찾고 싶습니다. 노동 조합이 세 테이블을 찾아 최대에 Data_ID, 즉 : 리턴 9테이블 조인 및 최대 열 값 찾기
내가 좋아하는 시도 : 조건 comm_name 짧은
사용하여 위치를
SELECT max(data_id) FROM ((SELECT table_1.data_id FROM table_1 where comm_name='aa') UNION(SELECT table_2.data_id FROM table_2 where comm_name='aa') UNION(SELECT table_3.data_id FROM table_2 where comm_name='aa'));
그러나 그 보여주는 오류
An expression was expected. (near "(" at position 26)
Unexpected token. (near "(" at position 26)
Unexpected token. (near "(" at position 27)
This type of clause was previously parsed. (near "SELECT" at position 29)
This type of clause was previously parsed. (near "SELECT" at position 125)
This type of clause was previously parsed. (near "SELECT" at position 220)
는 세 개의 테이블에 동일이 –