Reputation: 178
I have delete query, but it returned error [Err] 1064 - You have an error in your SQL syntax please help
DELETE FROM app_files tiko
where tiko.doc_type_id = 2102 and tiko.application_id IN
(SELECT c.id FROM cus_app c
WHERE c.`app_date`>='2017-01-27 00:01:01' AND c.`app_status` IN ('accepted'))
Upvotes: 1
Views: 2127
Reputation: 470
do not add alias if you are using DELETE FROM table, use table name directly.
Upvotes: 1
Reputation: 121
DELETE FROM app_files
where doc_type_id = 2102 and application_id IN
(SELECT c.id FROM cus_app c
WHERE c.`app_date`>='2017-01-27 00:01:01' AND c.`app_status` IN ('accepted'))
Upvotes: 0
Reputation: 1269873
No FROM
:
DELETE app_files tiko
where tiko.doc_type_id = 2102 and
tiko.application_id IN (SELECT c.id
FROM cus_app c
WHERE c.`app_date`>='2017-01-27 00:01:01' AND
c.`app_status` IN ('accepted')
);
Or . . .
delete tiko from app_files tiko
. . .;
Upvotes: 0