1. <tfoot id='H908R'></tfoot>

        <legend id='H908R'><style id='H908R'><dir id='H908R'><q id='H908R'></q></dir></style></legend>
        <i id='H908R'><tr id='H908R'><dt id='H908R'><q id='H908R'><span id='H908R'><b id='H908R'><form id='H908R'><ins id='H908R'></ins><ul id='H908R'></ul><sub id='H908R'></sub></form><legend id='H908R'></legend><bdo id='H908R'><pre id='H908R'><center id='H908R'></center></pre></bdo></b><th id='H908R'></th></span></q></dt></tr></i><div id='H908R'><tfoot id='H908R'></tfoot><dl id='H908R'><fieldset id='H908R'></fieldset></dl></div>
          <bdo id='H908R'></bdo><ul id='H908R'></ul>

        <small id='H908R'></small><noframes id='H908R'>

        使用 Join 的 Oracle 更新查询

        时间:2023-09-18

          <legend id='r6j5d'><style id='r6j5d'><dir id='r6j5d'><q id='r6j5d'></q></dir></style></legend>
          <i id='r6j5d'><tr id='r6j5d'><dt id='r6j5d'><q id='r6j5d'><span id='r6j5d'><b id='r6j5d'><form id='r6j5d'><ins id='r6j5d'></ins><ul id='r6j5d'></ul><sub id='r6j5d'></sub></form><legend id='r6j5d'></legend><bdo id='r6j5d'><pre id='r6j5d'><center id='r6j5d'></center></pre></bdo></b><th id='r6j5d'></th></span></q></dt></tr></i><div id='r6j5d'><tfoot id='r6j5d'></tfoot><dl id='r6j5d'><fieldset id='r6j5d'></fieldset></dl></div>

          <small id='r6j5d'></small><noframes id='r6j5d'>

            <tbody id='r6j5d'></tbody>
              • <bdo id='r6j5d'></bdo><ul id='r6j5d'></ul>
                  <tfoot id='r6j5d'></tfoot>
                  本文介绍了使用 Join 的 Oracle 更新查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 Join 更新金额,但出现异常:

                  I am trying to update the amount using Join but getting exception:

                  UPDATE tab1
                     SET tab1.total_adjusted_cost = tab1.total_adjusted_cost + t1.total
                   FROM table1 tab1, 
                        (SELECT tab3.name, tab3.add, SUM(tab2.amount) AS total
                           FROM table2 tab2,
                                table3 tab3,
                                table4 tab4
                          WHERE tab2.id = tab3.id
                            AND tab3.id = tab4.id
                            AND tab4.indicator = 'Y'
                          GROUP BY tab3.name, tab3.add ) t1
                  WHERE tab1.id = t1.id;
                  
                  
                  SQL Error: ORA-00933: SQL command not properly ended 00933. 00000 -  "SQL
                  command not properly ended"
                  

                  推荐答案

                  尝试使用合并

                  merge into table1 tab1 
                  using
                  (
                  SELECT tab3.name, tab3."add", SUM(tab2.amount) AS total
                    FROM table2 tab2,
                      table3 tab3 ,
                      table4 tab4
                    WHERE tab2.id        = tab3.id
                    AND tab3.id            = tab4.id
                    AND tab4.indicator             ='Y'
                    GROUP BY tab3.name,
                      tab3."add"
                  )t1
                  on(tab1.id      = t1.id)
                  when matched then 
                  update set tab1.total_adjusted_cost = tab1.total_adjusted_cost + t1.total
                  

                  这篇关于使用 Join 的 Oracle 更新查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Oracle 中使用 Join 查询进行更新 下一篇:如何使用 Oracle 10 g Forms 发送电子邮件

                  相关文章

                      <tfoot id='QSvYo'></tfoot>
                    1. <i id='QSvYo'><tr id='QSvYo'><dt id='QSvYo'><q id='QSvYo'><span id='QSvYo'><b id='QSvYo'><form id='QSvYo'><ins id='QSvYo'></ins><ul id='QSvYo'></ul><sub id='QSvYo'></sub></form><legend id='QSvYo'></legend><bdo id='QSvYo'><pre id='QSvYo'><center id='QSvYo'></center></pre></bdo></b><th id='QSvYo'></th></span></q></dt></tr></i><div id='QSvYo'><tfoot id='QSvYo'></tfoot><dl id='QSvYo'><fieldset id='QSvYo'></fieldset></dl></div>

                        <bdo id='QSvYo'></bdo><ul id='QSvYo'></ul>
                      <legend id='QSvYo'><style id='QSvYo'><dir id='QSvYo'><q id='QSvYo'></q></dir></style></legend>

                      <small id='QSvYo'></small><noframes id='QSvYo'>