POSTGRESQL에 문제가 있습니다.동시에 두 테이블을 업데이트하십시오. postgresql
두 테이블을 동시에 업데이트하려고합니다. 동일한 조건이므로 두 업데이트를 모두 적용 할 수 있습니다.
UPDATE standards.standards
SET description = 'The student will demonstrate positive self esteem.'
WHERE description LIKE 'The student will demonstrate positive his/her self esteem.'
AND custom_code LIKE 'qwertyuiop';
UPDATE bank SET description = 'The student will demonstrate positive self esteem.'
WHERE description LIKE 'The student will demonstrate positive his/her self esteem.'
AND designation LIKE 'asdfghjkl';
난 그냥 하나의 SQL 문에 모두 업데이트 할 :
여기에 개별 업데이 트입니다. POSTGRESQL은 두 테이블을 동시에 업데이트 할 수 없기 때문에 내가 한 일이지만 오류가 발생했습니다.
UPDATE standards.standards ss, bank bb
SET description = 'The student will demonstrate positive self esteem.'
WHERE description LIKE 'The student will demonstrate positive his/her self esteem.'
AND (ss.custom_code LIKE 'qwertyuiop' OR bb.designation LIKE 'asdfghjkl');
도와 주시겠습니까? 난 단지 하나의 SQL 문을 원한다. 감사!
이유를 한 문장으로 왜 사용해야합니까? 단일 트랜잭션에서 두 개의 업데이트 만 실행할 수 있습니까? 하나의 성명서로 어떤 문제를 해결하려고합니까? –
나는 결국 내 궁금해. 다른 대안은 무엇입니까? – asdasdas
왜 Postgresql 질문 일 때 MySQL에 태그를 지정해야합니까? 아니요, 하나의 delete 문에서 두 테이블을 삭제할 수 없습니다 (어쨌든 명시 적으로 트리거는 할 수 있지만 다른 이야기입니다). – jarlh