0

我是 sql 新手。我正在根据数据进行书面查询

如何编写查询来更新行;我想遵循这种格式;

UPDATE `reports_attributes` 
  (`ConID`,`CheckServices`,`Attribute1`,`Attribute2`,`Attribute3`,`Attribute4`,`Attribute5`,`Attribute6`,`Attribute7`,`Attribute8`) 
VALUES ('78','Execute Summary','criminality','color1','education','color5','employment_check_2','color7','report_status','color9')  
WHERE ConID=78 AND ReportType='interim_report' 
4

4 回答 4

2

更新语句语法与插入不同。

UPDATE reports_attributes 
 Set 
 ConID='78',
 CheckServices='Execute Summary',
 Attribute1='criminality',
 Attribute2='color1',
 Attribute3='education',
 Attribute4='color5',
 Attribute5='employment_check_2',
 Attribute6='color7',
 Attribute7='report_status',
 Attribute8='color9'
WHERE ConID=78 AND ReportType='interim_report'  
于 2012-05-16T09:29:56.583 回答
1

UPDATE 语句的语法是

UPDATE reports_attributes
    SET ConID = 78,
        CheckServices = xxx, 
        .
        .
        n
WHERE ConID=78 AND ReportType='interim_report' 
于 2012-05-16T09:28:10.590 回答
1

问题中的语法与更新语句的语法不匹配

UPDATE [LOW_PRIORITY] [IGNORE] table_reference
    SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...
    [WHERE where_condition]
    [ORDER BY ...]
    [LIMIT row_count]

有效更新语句的示例是:

UPDATE mytable
SET
    foo = "bar"
WHERE
    id = 123
于 2012-05-16T09:28:19.083 回答
1
UPDATE reports_attributes 
SET ConID='78', 
    CheckServices='Execute Summary' ,
    Attribute1='criminality', 
    Attribute2='color1', 
    Attribute3='education', 
    Attribute4='color5',
    Attribute5='employment_check_2',
    Attribute6='color7', 
    Attribute7='report_status', 
    Attribute8='color9' 
WHERE ConID=78 
      AND ReportType='interim_report'
于 2012-05-16T09:29:46.297 回答