반응형
'table'에서 'alias'로 삭제...여기서 'alias'.'열'...왜 구문 오류입니까?
MySQL로 해봤습니다.
DELETE FROM `contact_hostcommands_relation` AS `ContactHostCommand` WHERE (`ContactHostCommand`.`chr_id` = 999999) LIMIT 1
이해가 됩니다.
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (`ContactHostCommand`.`chr_id` = 999999) LIMIT 1' at line 1
참고: 이 쿼리는 자동으로 생성되며 조건은 테이블 별칭을 기반으로 합니다.
왜 이런 오류가 발생합니까?
where 절에서 테이블 별칭을 사용할 수 있는 방법이 있습니까?
MySQL이 특정한 건가요?
MSSQL에 대해 @Matus와 @CeesTimmerman이 말한 내용은 MySQL 5.1.73에서도 작동합니다.
delete <alias> from <table> <alias> where <alias>.<field>...
SQL은 다음과 같이 사용할 수 있습니다.
DELETE FROM ContactHostCommand
USING `contact_hostcommands_relation` AS ContactHostCommand
WHERE (ContactHostCommand.`chr_id` = 999999)
LIMIT 1
사용할수없습니다AS
일순간에DELETE
MySQL이 포함된 절:
DELETE FROM `contact_hostcommands_relation` WHERE (`chr_id` = 999999) LIMIT 1
MySQL에서 Alias를 사용하려면 다음을 사용해 보십시오.
DELETE <alias_name> FROM <alias_table> <alias_name> WHERE <alias_name>.nameofcolumn LIKE '%XXXXX%'
언급URL : https://stackoverflow.com/questions/10484532/delete-from-table-as-alias-where-alias-column-why-syntax-error
반응형
'programing' 카테고리의 다른 글
상대 경로가 있는 다른 PowerShell 스크립트를 호출하려면 어떻게 해야 합니까? (0) | 2023.11.04 |
---|---|
숨김 및 표시 설정에서 작동하지 않는 ng-애니메이트 (0) | 2023.11.04 |
WooCommerce에서 모든 체크아웃 필드를 가져오는 방법은? (0) | 2023.11.04 |
자바스크립트 .replace는 첫번째 Match만 바꿉니다. (0) | 2023.11.04 |
800px 이후 divon 스크롤다운 표시 (0) | 2023.11.04 |