从select语法错误更新Mysql

时间:2016-04-04 05:47:28

标签: mysql

查询

我试图执行以下查询,但在我的phpmyadmin中说

  
      
  • 您的SQL语法有错误;检查与您的MariaDB服务器版本相对应的手册,以便在#ett; FROM eest_estimated_total pet INNER JOIN eest_total pt ON pt.OrderNo = pet.Order'附近使用正确的语法。在第1行
  •   
<ul>
                <li><a href="<?php echo $CFG->wwwroot;?>"><?php echo get_string('home'); ?></a></li>
                <li><a href="http://yourdomain.com/course/index.php"><?php echo get_string('courses'); ?></a></li>
                <li><a href="http://yourdomain.com/aboutus.php">About Us</a></li>
                <li><a href="http://yourdomain.com/blog/index.php">Blog</a></li>
                <li><a href="http://yourdomain.com/gallery.php">Gallery</a></li>
                <li><a href="http://yourdomain.com/contactus.php">Contact Us</a></li></ul>

所以我可能知道我在哪里做错了吗?

3 个答案:

答案 0 :(得分:1)

尝试这种方式:

UPDATE pipo_estimated_total AS pet
INNER JOIN pipo_total AS pt 
ON pt.OrderNo = pet.OrderNo 
SET pet.Freight = pt.FrieghtCost, pet.CustomDuty = pt.ImportDuty   
WHERE pt.OrderNo = pet.OrderNo

答案 1 :(得分:0)

运行此查询: -

UPDATE pipo_estimated_total 
SET pet.Freight = pt.FrieghtCost, pet.CustomDuty = pt.ImportDuty 
FROM pipo_estimated_total AS pet 
INNER JOIN pipo_total pt 
ON pt.OrderNo = pet.OrderNo 
WHERE pt.OrderNo = pet.OrderNo

答案 2 :(得分:0)

正如答案所说:update-from-select-using-sql-server

UPDATE
    Table_A
SET
    Table_A.col1 = Table_B.col1,
    Table_A.col2 = Table_B.col2
FROM
    Some_Table Table_A
INNER JOIN
    Other_Table Table_B
ON
    Table_A.id = Table_B.id
WHERE
    Table_A.col3 = 'cool'

你的答案:

UPDATE pet
SET pet.Freight = pt.FrieghtCost, pet.CustomDuty = pt.ImportDuty 
FROM eest_estimated_total pet 
INNER JOIN eest_total pt 
ON pt.OrderNo = pet.OrderNo 
WHERE pt.OrderNo = pet.OrderNo