我正在使用 SQL Server Management Studio 测试一些 SQL 查询,下面的查询据说有“',''附近的语法不正确,这是 'image_uuid' 之后的逗号。我阅读了语法,我认为我正确地列出了列。
我需要将行从一个表移动到存档表。我将使用此语句,然后删除我移动的行。如果有更简洁的方法来执行此操作,请解释我还能做什么。谢谢!
INSERT INTO litmus_mailing_archive(image_uuid, server_id, list_id, mailing_id,
litmus_job_id, email_subject, test_email_message_id,
test_running, test_started, test_finished,
ended_with_error, images_purged, notification_email)
SELECT
(image_uuid, server_id, list_id, mailing_id,
litmus_job_id, email_subject, test_email_message_id,
test_running, test_started, test_finished,
ended_with_error, images_purged, notification_email)
FROM
litmus_mailing
WHERE
server_id = ?
AND list_id = ?
AND mailing_id = ?
AND test_running = 'false';
问号只是信息的占位符。当我对其进行测试时,我会插入 litmus_mailing
中的实际数据。
最佳答案
从选择查询中删除括号:
SELECT (image_uuid, server_id, list_id, mailing_id,
litmus_job_id, email_subject, test_email_message_id,
test_running, test_started, test_finished, ended_with_error,
images_purged, notification_email)
改成这样:
SELECT image_uuid, server_id, list_id, mailing_id,
litmus_job_id, email_subject, test_email_message_id,
test_running, test_started, test_finished,
ended_with_error, images_purged, notification_email
关于sql-server - SQL Server Management Studio 说此语句不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35949650/