经典SQL语句-ORACLE

merger into的用法-插入、更新前先判断、 传入参数
    merge into ad_accessrec s
    using
    (
       select 20885 id,to_date('2008-2-27','yyyy-mm-dd') time, 127367 placeid,31 a,3 b from dual) t
     --  on (t.adid=20885  and t.accesstime=to_date('2008-2-27','yyyy-mm-dd') and t.placeid=127367 and t.kindtechid=31  and t.status=3)
      on (s.adid=t.id and s.placeid=t.time)
      when matched
       then update set s.ipcnt=200
       when not matched
       then   insert(ordid,adid,placeid,accesstime,pointid,kindtechid,ipcnt,status)
          values(ad_accessrec_seq.nextval,20885,127367,to_date(2008-2-27,'yyyy-mm-dd'),13928,31,100,3);        
1、取符合条件的记录前5条
select * from
(
select adid,arrid,row_number() over(partition by arrid order by arrid) total  from  ad_adset a
)
where total<=5


合并同一ID的其他列的内容
 select videoid, wm_concat(c_name) tagname
                  from pmh_video_category t6, pmh_category_config t7
                 where t6.cid = t7.cid
                 group by videoid;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值