이 select 문이 있습니다.
select it.item_id
from item as it
where it.owning_collection in (select col.collection_id
from collection as col
where col.name like '%Restricted%'
약 3k 결과를 반환합니다. 이제 다음과 같은 매개 변수 중 하나로 해당 item_id를 사용하여 해당 결과 각각에 대해 다른 테이블에 삽입하고 싶습니다.
insert into metadatavalue (metadata_value_id, **item_id**, metadata_field_id, text_value, text_lang, place, confidence)
하지만 데이터베이스에 대한 경험이 많지 않기 때문에 이러한 다중 삽입을 만드는 방법을 잘 모르겠습니다.
insert 문에 필요한 다른 모든 정보는 고정 값입니다.
테이블 구조 :
Table Item
*item_id
*submitter_id
*in_archive
*withdrawn
*last_modified
*owning_collection
*dicoverable
Table metadata
*metadata_value_id
*item_id
*metadata_field_id
*text_value
*text_lang
*place
*authority
*confidence
insert into metadatavalue (metadata_value_id, item_id, metadata_field_id, text_value, text_lang, place, confidence)
select 'metadata_value_id',it.item_id,'metadata_field_id','text_value', 'text_lang', 'place', 'confidence'
from item it
where it.owning_collection in (select col.collection_id
from collection as col
where col.name like '%Restricted%')
'아 포스트 로프'열을 기본값으로 바꿉니다.
추가 읽기 .
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다