zoukankan      html  css  js  c++  java
  • oracle数据库语句积累

    1、从一个表选出数据更新另一个表(后面的exists一定要加)

    update jqhdzt
       set shid =
           (select shid
              from v_plat_userjqinfo t
             where jqhdzt.jqbh = t.JQBH
               and jqhdzt.shid <> t.SHID)
     where shid = '0000010047'
       and exists (select 1
              from v_plat_userjqinfo t
             where jqhdzt.jqbh = t.JQBH
               and jqhdzt.shid <> t.SHID)

     2、查询字段值相同的记录总数量

       1)单个字段查询

    select t.name,count(1) from tuser t   having count(1)>1  group by t.name

       2)多个字段查询

    SELECT t.spbh,t.spmc,t.shid,COUNT(*) FROM spxx t GROUP BY t.spbh,t.spmc,t.shid HAVING COUNT(*) > 1
  • 相关阅读:
    IO模型
    协程
    线程
    进程
    网络编程
    模块二
    面向对象(二)
    面向对象(一)
    优化异常报错
    python 模块
  • 原文地址:https://www.cnblogs.com/aegisada/p/6183825.html
Copyright © 2011-2022 走看看