2
JOOQ는 지정된 열에 'select into select'구문을 사용할 수 있습니까? 나는 ..JOOQ은 지정된 열이있는 선택 구문에 삽입
테이블 여러 가지 시도를 실행
표 (예상 삽입)
id column1 column2 column3 ... timestamp 1 John Leo null 2012/1/28 23:32:23 (Expected insert)
표 2
id col1 col2 col3 101 John xxx xxx (from table2.col1) 102 xxx xxx xxx
표 3
id col1 col2 col3 101 xxx Leo xxx (from table3.col2) 102 xxx xxx xxx
INSERT INTO table1 (column1, column2)
SELECT table2.col1, table3.col2
FROM table2 join table3 t3 on table2.id = table3.id
where table2.id = 101;
,451,515,
JOOQ 코드 :
create.insertInto(table1, column1, column2)
.values(create.select(table2.col1, table3.col2)
.from(table2)
.join(table3)
.on(table12.id.equal(table3.id))
.where(table2.id.equal(101)))
.execute(); //.getSQL();
JOOQ 쇼 오류 메시지 :
The number of values must match the number of fields
누구든지 내가 만드는 어떤 문제를 알고 내 JOOQ 코드를 수정하는 방법에 대해 설명합니다. 고마워요, Pay.
참조 : 당신은 대신 INSERT .. SELECT
구문의 INSERT .. VALUES
구문을 사용하고 Example: INSERT SELECT syntax support
귀하의 경우에는,이 (jOOQ 3.x의에서 더 이상 사용할 수 jOOQ 2.x에서 구문을) 읽을 것 column2 값은 'table3.col2'에서 제공됩니다 – payliu
내 문제는 table1에 2 개 이상의 열이있는 경우 어떻게 table1에 대해 지정된 열을 사용할 수 있습니까? – payliu
INSERT SELECT의 예는 모든 열 값으로 복사를위한 것입니다. – payliu